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

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -