当手机上有推送通知时,我需要保存一个标志。当应用程序是前台时,我能够实现这一点。但是当应用程序关闭或在后台运行时,它不起作用。代码如下
await ParsePush.SubscribeAsync("");
ParsePush.ToastNotificationReceived += OnPushNotification;
private async void OnPushNotification(object sender,Windows.Networking.PushNotifications.PushNotificationReceivedEventArgs e)
{
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values["Add"] = "true";
}
即使应用程序关闭或在后台运行,我是否有办法保存LocalSettings。任何帮助表示赞赏。