From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Boolean )
aiOSLocation.Enabled = newBooleanValue
BooleanValue = aiOSLocation.Enabled

Supported on Mobile (iOS).

Default is False. Set Enabled to True so that the LocationChanged event is called at appropriate times. Set this to False when you do not need locations in order to not waste battery power.


Do not enable if AuthorizationState is AuthorizationStates.Restricted or AuthorizationStates.Denied.

Sample Code

You will typically use code like this in the Open event handler of your view to initialize iOSLocation:

If MyLocation.AuthorizationState = iOSLocation.AuthorizationStates.AuthorizedWhenInUse Then
// we've got our requested authorization state, start getting LocationChanged events
MyLocation.Enabled = True
// we don't have authorization yet, so ask for it
End If