MobileLocation.RequestUsageAuthorization

From Xojo Documentation

Method

MobileLocation.RequestUsageAuthorization(usageType As MobileLocation.UsageTypes)

Supported on Mobile.

Request authorization for this app to use location information.

Notes

You can request authorization to obtain the device's location either only while your app is in use or at all times. See the AuthorizationStates enumeration for details.

Sample Code

If myLocation.AuthorizationState = MobileLocation.AuthorizationStates.AuthorizedAppInUse Then
// we've got our requested authorization state, start getting LocationChanged events
MyLocation.Enabled = True
Else
// we don't have authorization yet, so ask for it
MyLocation.RequestUsageAuthorization(MobileLocation.UsageTypes.AppInUse)
End If

See Also

AuthorizationStates and UsageTypes enumerations.