I am having a strange problem with my Windows Phone 8.1 application. The app will send a toast notification every time a user is near their point of interest using Geofence Quick Start: setting up a geoforum
and BackgroundTask Quick Start: listening to geophony events in the background
And this is a background task (example)
public void Run(IBackgroundTaskInstance taskInstance)
{
var reports = GeofenceMonitor.Current.ReadReports();
var report = reports.FirstOrDefault(r => (r.Geofence.Id == "id") && (r.NewState == GeofenceState.Entered));
if (report == null) return;
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, , . , Geofence BackgroundTask ( , , , : s)... - .
, " + ", Package.appxmanifest Toast Capable: YES.
- , ?