c# - Microsoft.Phone.Scheduler.Alarm in a BackgroundTask -
i recommend assistance.
i using silverlight 8.1 program gps based alarm app (because microsoft.phone.scheduler.alarm api blocked in wp 8.1). trying create backgroundtask triggered geofencemonitor.
my problem backgroundtask must located in "windows runtime component" project , can't set compilation target silverlight 8.1, cannot create alarm in there.
is there workaround or impossible launch alarm backgroundtask? appreciate every solution.
unfortunately cannot mix winrt , wp8.1 silverlight.
as mentioned alarm api doesn't work wp (so "universal") , silverlight runtime doesn't have geofencemonitor. can have silverlight project winrt background task, won't anywhere.
i don't know if want these alarms permanently associated location or rather short-lived, maybe solution:
configure app keep running in background. there dedicated "locationtracking" execution type can use app tracks gps position in background (see this site details).
you can use positionchanged event of geolocator check if within fence , add (almost) instant alarm.
const string id = "whateveryouridis"; var existing = scheduledactionservice.find(id); if(existing != null) scheduledactionservice.remove(id); alarm alarm = new alarm(id) { begintime = datetime.now.addseconds(1), content = "you have reached location!", }; scheduledactionservice.add(alarm); if don't want keep app running, (propably) launch background task (sl) within geo-fencing background task (winrt).
Comments
Post a Comment