Provide UI for reenabling location services. Provide an alternate way to manually enter location info when location data is not available via location services. If your app saves or caches location data, clear any cached data when the user revokes access to location info. The app will then receive ACCESS_DENIED results for any location API calls. Release the Geolocator object if the user turns off access to location info through Settings. For more info, see Launch the Windows Settings app.Ĭlear cached location data and release the Geolocator when the user disables access to location info. For example, you could use a Hyperlink control or call the LaunchUriAsync method to launch the Settings app from code using the ms-settings:privacy-location URI. If the location settings don't allow your app to access the user's location, we recommend providing a convenient link to the location privacy settings in the Settings app. Show appropriate error messages or dialogs when location services are disabled or not available. Provide UI to enable users to manually refresh their location.ĭisplay a progress bar or ring while waiting to get location data. Tell the user how location data will be used. The first use of the Geolocator can be either the first call to getGeopositionAsync or the first registration of a handler for the positionChanged event. The first use of the Geolocator object must be made on the main UI thread of the foreground app, to trigger the consent prompt to the user. It's okay to immediately access location if it is required for your app's main function. For example, if a social networking app has a button for "Check in with my location," the app shouldn't access location until the user clicks the button. If location isn't essential to your app, don't access it until the user tries to complete a task that requires it. Until the user grants your app permission to their location, your app can't access location data. At that time, your app must be in the foreground and RequestAccessAsync must be called from the UI thread. Start using the location object only when the app requires location data.Ĭall the RequestAccessAsync before accessing the user’s location. This topic describes performance guidelines for apps that require access to a user's location.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |