在应用程序处于后台时收到推送通知时保存在localSettings中

时间:2015-07-07 09:21:27

标签: c# windows-phone-8.1

当手机上有推送通知时,我需要保存一个标志。当应用程序是前台时,我能够实现这一点。但是当应用程序关闭或在后台运行时,它不起作用。代码如下

 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。任何帮助表示赞赏。

0 个答案:

没有答案