c# – Toast通知和地理栅栏Windows Phone 8.1

c# – Toast通知和地理栅栏Windows Phone 8.1,第1张

概述我的 Windows Phone 8.1应用程序遇到了一个奇怪的问题. 每当用户使用Geofence Quickstart: Setting up a geofence接近他感兴趣的点时,该应用程序将发送一个Toast通知 和BackgroundTask Quickstart: Listening for geofence events in the background 这是后台任务(示例) p 我的 Windows Phone 8.1应用程序遇到了一个奇怪的问题.
每当用户使用Geofence Quickstart: Setting up a geofence接近他感兴趣的点时,该应用程序将发送一个Toast通知
和BackgroundTask Quickstart: Listening for geofence events in the background

这是后台任务(示例)

public voID Run(IBackgroundTaskInstance taskInstance){    // Get the information of the geofence(s) that have been hit    var reports = GeofenceMonitor.Current.ReadReports();    var report = reports.FirstOrDefault(r => (r.Geofence.ID == "ID") && (r.NewState == GeofenceState.Entered));    if (report == null) return;    // Create a toast notification to show a geofence has been hit    var toastXmlContent = Toastnotificationmanager.GetTemplateContent(ToastTemplateType.ToastText02);    var txtNodes = toastXmlContent.GetElementsByTagname("text");    txtNodes[0].AppendChild(toastXmlContent.CreateTextNode("Geofence triggered toast!"));    txtNodes[1].AppendChild(toastXmlContent.CreateTextNode(report.Geofence.ID));    var toast = new ToastNotification(toastXmlContent);    var toastNotifIEr = Toastnotificationmanager.CreatetoastNotifIEr();    toastNotifIEr.Show(toast);}

现在的问题是,如果我从VS运行应用程序一切正常并且一旦进入特定区域就会触发Toast …如果我使用windows Phone应用程序部署在设备上安装应用程序,该应用程序工作正常,同样使用模拟器.但是一旦上传到商店,我已经下载了应用程序和Toast,Geofence或BackgroundTask不再工作(我猜问题是这三个中的一个,但我不知道谁是罪魁祸首:s)..吐司通知不会触发..

我还注意到我的应用程序未列在“通知 *** 作”设置中,但在Package.appxmanifest中我设置了Toast Capable:YES.

谁知道如何解决这个问题?谢谢

解决方法 应用程序可能在后台抛出异常,但由于这是在后台,您无法看到它.我发现解决此类问题的唯一方法是向应用程序添加日志记录功能,以便您能够看到异常 总结

以上是内存溢出为你收集整理的c# – Toast通知和地理栅栏Windows Phone 8.1全部内容,希望文章能够帮你解决c# – Toast通知和地理栅栏Windows Phone 8.1所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1230774.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存