我需要使用通过在线MVC应用程序发送的详细信息更新SQLite数据库,该应用程序将Firebase数据消息发送到链接到特定用户个人资料的Xamarin应用程序 当应用程序处于前台时,我可以使用firebase数据消息中包含的详细信息直接更新数据库。
问题是我需要在应用程序处于关闭状态时更新数据库,因此当他们打开数据库时,UI和数据状态已经构建好并可供用户使用(而无需执行HTTP请求即可)获取任何新信息)
通过工作,我发现我必须使用Firebase.Jobdispatcher ...但是我发现它似乎已被弃用。
public override void OnmessageReceived(RemoteMessage message)
{
base.OnmessageReceived(message);
//Custom message received
if (IsApplicationInTheBackground())
{
//The send notification sends the push notification no problem
SendNotification(message.GetNotification().Body,message.Data);
//I wish to add specific code to write to the SQLite here
} else
{
//Notify within the application using snackbar
var mA = new MessageAndroid();
mA.ShortAlert(message.GetNotification().Body);
var uti = new FindMyDriver(); //Location pin pointing request
uti.ReturnLocationAsync(message.GetNotification().Body);
}
}
在其方框中指出“我希望添加特定的代码..”,我想保存有关已从MVC应用程序发送到已注册电话上的链接用户应用程序的负载的特定详细信息。
我想在应用处于离线/后台状态时调用特定的空白来运行。
最近对服务等的所有控制都是可行的吗?