c# - Windows 10 Universal App - Geofence Background task not being triggered -


i'm trying create windows uap (c#) log location data in background task, i'm trying start background task off of geofence trigger.

i've followed lot of guides how this, i've added entry point in package.appxmanifest "backgroundtask.locationbackgroundtask" , selected location property.

i'm registering task using following:

var result = await backgroundexecutionmanager.requestaccessasync(); var builder = new backgroundtaskbuilder(); builder.name = backgroundtaskname; builder.taskentrypoint = backgroundtaskentrypoint; builder.settrigger(new locationtrigger(locationtriggertype.geofence)); var geofencetask = builder.register(); 

i use following code verify if background task registered , returns true indicate task registered:

public bool istaskregistered() {     var registered = false;     var entry = backgroundtaskregistration.alltasks.firstordefault(keyval => keyval.value.name == backgroundtaskname);     if (entry.value != null)         registered = true;     return registered; } 

the problem i'm having run method in background task not getting triggered.

to verify background task good, swapped out trigger type builder.settrigger(new systemtrigger(systemtriggertype.powerstatechange, true)); (and updated package.appxmanifest have system event property). worked fine background task triggered i'd expect when unplugged power source laptop.

the other thing note when debugging don't see background task under lifecycle events whereas when testing systemtrigger.

the problem therefore seem specific geofence triggering. i'm starting pull hair out bit on grateful suggestions.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -