Depuis 10.0.14393
(Anniversery Update), LocationTrigger
ne semble pas fonctionner. J'ai:Windows 10 Mobile (10.0.14393) Tâche d'arrière-plan pour Geofence (LocationTrigger)
- Une application Windows Phone 8.1 (s'applique également à une application UWP).
- Une bibliothèque portable qui Ouputs à une bibliothèque
Windows Runtime Component
(.winmd
) - Une déclaration de Contexte Tâche avec Lieu capacités (ensemble à la bibliothèque que l'entrée).
- Accès avec
BackgroundExecutionManager.RequestAccessAsync()
- Un
LocationTrigger
de typeGeofence
.
La tâche d'arrière-plan n'est jamais déclenchée. Inscription/code tâche après avoir accès:
public sealed class GeofenceTask : IBackgroundTask
{
public static void Register()
{
var taskName = nameof(GeofenceTask);
foreach (var n in BackgroundTaskRegistration.AllTasks.Where(n => n.Value.Name == taskName))
{
n.Value.Unregister(true);
break;
}
var builder = new BackgroundTaskBuilder {Name = taskName, TaskEntryPoint = typeof (GeofenceTask).FullName};
builder.SetTrigger(new LocationTrigger(LocationTriggerType.Geofence));
builder.Register();
}
public void Run(IBackgroundTaskInstance taskInstance)
{
// Do magic.
}
}
fonctionne sur un appareil Windows Phone 8.1 ou fonctionne émulateur. Pré-mise à jour, cela a également fonctionné sur Windows 10 Mobile. Existe-t-il des solutions connues jusqu'à présent?
Avez-vous vérifié l'échantillon s'il y a des différences (et surtout si l'échantillon fonctionne comme prévu sur votre appareil)? https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/Geolocation –
L'exemple ne fonctionne pas non plus comme prévu @MZetko (le 10.0.14393) –
Nous étudions ce problème, merci de nous avoir signalé –