

If you do set up both foreground and background geofence listeners, there is no guarantee which will be triggered first and so you must always call the ReadReports method to find out if an event has occurred. The cleanest method for handling a case where you might need both is to let the background task handle the notifications. In general, your app doesn't need to listen for Geofence events both in the foreground and in a background task at the same time. Depending on the functionality of your app, you may want to filter out this event. From the current location, you can see that the user is now back outside of the geofence.


The user was busy and does not notice the notification until 10 minutes later.Your app sends a notification to the user that they are now inside the geofence.The user moves the device inside of the geofence, causing an enter event to be triggered.Your app creates a geofence and monitors the geofence for enter and exit events.For example, the following sequence may occur: Various factors, such as the system not having enough resources to launch a background task, the user not noticing the notification, or the device being in standby (on Windows), may affect when the event is actually processed by the user. When an event indicates a change to an Entered or Exited state, check both the time stamp of the event and your current location. If your app needs to use a geofence with a small radius, advise users to use your app on a device with a GPS radio to ensure the best performance.Īdditional usage guidance Checking the time stamp and current location The system actually supports thousands of geofences per app, you can maintain good app performance to help reduce the app's memory usage by using no more than 1000.ĭon't create a geofence with a radius smaller than 50 meters.
WINDOWS 10 FENCES APP CODE
See Background and foreground listeners for code examples and more information.ĭon't use more than 1000 geofences per app.

For more info about getting and setting a maps authentication key, see Request a maps authentication key.įollow these best practices for geofencing in your app. MapControl and map services requite a maps authentication key called a MapServiceToken.
