Class

# MobileLocation

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

The current location of the device.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                            | Type                                                      | Read-Only | Shared |
|-----------------------------------------------------------------|-----------------------------------------------------------|-----------|--------|
| `Accuracy<mobilelocation.accuracy>`                             | `Accuracies<mobilelocation.accuracies>`                   |           |        |
| `AllowBackgroundUpdates<mobilelocation.allowbackgroundupdates>` | `Boolean</api/data_types/boolean>`                        |           |        |
| `AuthorizationState<mobilelocation.authorizationstate>`         | `AuthorizationStates<mobilelocation.authorizationstates>` | ✓         |        |
| `Name<mobilelocation.name>`                                     | `String</api/data_types/string>`                          | ✓         |        |
| `VisitAwareness<mobilelocation.visitawareness>`                 | `Boolean</api/data_types/boolean>`                        |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                                  | Parameters                                                                                                      | Returns                                     | Shared |
|-----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------|--------|
| `AddRegion<mobilelocation.addregion>`                                 | region As `MobileCircularRegion</api/mobile/mobilecircularregion>`                                              |                                             |        |
| `AddRegionAt<mobilelocation.addregionat>`                             | index As `Integer</api/data_types/integer>`, region As `MobileCircularRegion</api/mobile/mobilecircularregion>` |                                             |        |
| `AddAllRegions<mobilelocation.addallregions>`                         | regions() As `MobileCircularRegion</api/mobile/mobilecircularregion>`                                           |                                             |        |
| `Handle<mobilelocation.handle>`                                       |                                                                                                                 | `Ptr</api/data_types/additional_types/ptr>` |        |
| `RegionAt<mobilelocation.regionat>`                                   | index As `Integer</api/data_types/integer>`                                                                     |                                             |        |
| `Regions<mobilelocation.regions>`                                     | `MobileCircularRegions()</api/mobile/mobilecircularregion>`                                                     |                                             |        |
| `RemoveRegion<mobilelocation.removeregion>`                           | region As `MobileCircularRegion</api/mobile/mobilecircularregion>`                                              |                                             |        |
| `RemoveRegionAt<mobilelocation.removeregionat>`                       | index As `Integer</api/data_types/integer>`                                                                     |                                             |        |
| `RemoveAllRegions<mobilelocation.removeallregions>`                   |                                                                                                                 |                                             |        |
| `RequestUsageAuthorization<mobilelocation.requestusageauthorization>` | usageType As `MobileLocation.UsageTypes<mobilelocation.usagetypes>`                                             |                                             |        |
| `Start<mobilelocation.start>`                                         |                                                                                                                 |                                             |        |
| `Stop<mobilelocation.stop>`                                           |                                                                                                                 |                                             |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                                  | Parameters                                                                                                                                                                                                                                                                                                                                                                              | Returns |
|-----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `AuthorizationStateChanged<mobilelocation.authorizationstatechanged>` | state As `MobileLocation.AuthorizationStates<mobilelocation.authorizationstates>`                                                                                                                                                                                                                                                                                                       |         |
| `Closing<mobilelocation.closing>`                                     |                                                                                                                                                                                                                                                                                                                                                                                         |         |
| `LocationChanged<mobilelocation.locationchanged>`                     | latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, accuracy As `Double</api/data_types/double>`, altitude As `Double</api/data_types/double>`, altitudeAccuracy As `Double</api/data_types/double>`, course As `Double</api/data_types/double>`, speed As `Double</api/data_types/double>`, timeStamp As `DateTime</api/data_types/datetime>` |         |
| `Opening<mobilelocation.opening>`                                     |                                                                                                                                                                                                                                                                                                                                                                                         |         |
| `RegionEntered<mobilelocation.regionentered>`                         | region As `MobileCircularRegion</api/mobile/mobilecircularregion>`                                                                                                                                                                                                                                                                                                                      |         |
| `RegionExited<mobilelocation.regionexited>`                           | region As `MobileCircularRegion</api/mobile/mobilecircularregion>`                                                                                                                                                                                                                                                                                                                      |         |
| `VisitChanged<mobilelocation.visitchanged>`                           | latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, accuracy As `Double</api/data_types/double>`, arrival As `DateTime</api/data_types/datetime>`, departure As `DateTime</api/data_types/datetime>`                                                                                                                                           |         |

## Enumerations

<div id="mobilelocation.accuracies">

<div class="rst-class">

forsearch

</div>

</div>

MobileLocation.Accuracies

### Accuracies

> The available degrees of accuracy to track. Used by the Accuracy property.
>
> | Enum              | Description                                                                                                                                                                                                                                                                 |
> |-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
> | BestForNavigation | Use the highest possible accuracy and combine it with additional sensor data. This level of accuracy is intended for use in navigation applications that require precise position information at all times and are intended to be used only while the device is plugged in. |
> | Best              | (Default) Use the highest-level of accuracy.                                                                                                                                                                                                                                |
> | Reduced           | Infrequent location change updates to greatly preserve battery life.                                                                                                                                                                                                        |
> | Within10Meters    | Accurate to within 10 meters of the desired target.                                                                                                                                                                                                                         |
> | Within100Meters   | Accurate to within 100 meters.                                                                                                                                                                                                                                              |
> | Within1Kilometer  | Accurate to within 1 kilometer.                                                                                                                                                                                                                                             |
> | Within3Kilometers | Accurate to within 3 kilometers.                                                                                                                                                                                                                                            |

<div id="mobilelocation.authorizationstates">

<div class="rst-class">

forsearch

</div>

</div>

MobileLocation.AuthorizationStates

### AuthorizationStates

> These are the available authorization states for an app. The AuthorizationState property contains the type of location the user has authorized.
>
> | Enum               | Description                                                                                                                                                                                                                                                           |
> |--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
> | NotDetermined      | The user has not yet made a choice regarding whether this app can use location services.                                                                                                                                                                              |
> | Restricted         | This app is not authorized to use location services. The user cannot change this app's status, possibly due to active restrictions such as parental controls being in place.                                                                                          |
> | Denied             | The user explicitly denied the use of location services for this app or location services are currently disabled in Settings.                                                                                                                                         |
> | AuthorizedAlways   | This app is authorized to start location services at any time. This authorization allows you to use all location services, including those for monitoring regions and significant location changes.                                                                   |
> | AuthorizedAppInUse | This app is authorized to start most location services while running in the foreground. This authorization does not allow you to use APIs that could launch your app in response to an event, such as region monitoring and the significant location change services. |

<div id="mobilelocation.usagetypes">

<div class="rst-class">

forsearch

</div>

</div>

MobileLocation.UsageTypes

### UsageTypes

> Used to indicate when your app will need access to the device's location.
>
> | Enum     | Description                                                                                                      |
> |----------|------------------------------------------------------------------------------------------------------------------|
> | Always   | You are requesting that the OS update your app on the device's location any time it changes.                     |
> | AppInUse | You are requesting that the OS update your app on the device's location only when your app is in the foreground. |

## Property descriptions

<div id="mobilelocation.accuracy">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Accuracy

**Accuracy** As `Accuracies<mobilelocation.accuracies>`

> Specifies the level of accuracy you need for the location data.
>
> You should assign a value to this property that is appropriate for your usage scenario. The default is Best. For example, if you need the current location only within a kilometer, you should specify Accuracies.Within1Kilometer and not Accuracies.BestForNavigation. Determining a location with greater accuracy requires more time and more power.
>
> ``` xojo
> MyLocation.Accuracy = MobileLocation.Accuracies.Within1Kilometer
> ```

<div id="mobilelocation.allowbackgroundupdates">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.AllowBackgroundUpdates

**AllowBackgroundUpdates** As `Boolean</api/data_types/boolean>`

> Allows the location to be updated by the OS even when the application is not the frontmost application.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.authorizationstate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.AuthorizationState

**AuthorizationState** As `AuthorizationStates<mobilelocation.authorizationstates>`

> Returns the app's authorization state for using location services.
>
> This property is read-only.

<div id="mobilelocation.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Name

**Name** As `String</api/data_types/string>`

> The name of the control.
>
> This property is read-only.

<div id="mobilelocation.visitawareness">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.VisitAwareness

**VisitAwareness** As `Boolean</api/data_types/boolean>`

> Tells the device to begin tracking arrivals and departures from locations.
>
> This is a power-efficient way to track user location.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

## Method descriptions

<div id="mobilelocation.addregion">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.AddRegion

**AddRegion**(region As `MobileCircularRegion</api/mobile/mobilecircularregion>`)

> Adds the *region* passed to the list of regions to be monitored for user entry and exit.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.addregionat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.AddRegion

**AddRegion**(index As `Integer</api/data_types/integer>`, region As `MobileCircularRegion</api/mobile/mobilecircularregion>`)

> Adds the *region* passed at the *index* passed to the list of regions to be monitored for user entry and exit.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.addallregions">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.AddAllRegions

**AddAllRegions**(regions() As `MobileCircularRegion</api/mobile/mobilecircularregion>`)

> Adds all regions in the array of *regions* passed to the list of regions to be monitored for user entry and exit.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> The handle to the underlying native OS control.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is supported for iOS only.
>
> </div>

<div id="mobilelocation.regionat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RegionAt

**RegionAt**(index As `Integer</api/data_types/integer>`) As `MobileCircularRegion</api/mobile/mobilecircularregion>`

> Returns the region at the *index* passed.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.regions">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Regions

**Regions** As `MobileCircularRegion()</api/mobile/mobilecircularregion>`

> Returns an array of all regions that have been added.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.removeregion">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RemoveRegion

**RemoveRegion**(region As `MobileCircularRegion</api/mobile/mobilecircularregion>`)

> Removes the *region* passed from the list of regions to be monitored for user entry and exit.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.removeregionat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RemoveRegionAt

**RemoveRegionAt**(index As `Integer</api/data_types/integer>`)

> Removes the region at the *index* passed from the list of regions to be monitored for user entry and exit.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.removeallregions">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RemoveAllRegions

**RemoveAllRegions**

> Removes all regions from the list of regions to be monitored for user entry and exit.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilelocation.requestusageauthorization">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RequestUsageAuthorization

**RequestUsageAuthorization**(usageType As `MobileLocation.UsageTypes<mobilelocation.usagetypes>`)

> Request authorization for this app to use location information.
>
> 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<mobilelocation.authorizationstates>` enumeration for details.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android. Calling it will raise an `PlatformNotSupportedException</api/exceptions/platformnotsupportedexception>`.
>
> </div>
>
> ``` xojo
> If myLocation.AuthorizationState = MobileLocation.AuthorizationStates.AuthorizedAppInUse Then
>    ' we've got our requested authorization state, start getting LocationChanged events
>    MyLocation.Start
> Else
>    ' we don't have authorization yet, so ask for it
>    MyLocation.RequestUsageAuthorization(MobileLocation.UsageTypes.AppInUse)
> End If
> ```

<div id="mobilelocation.start">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Start

**Start**

> Start receiving location information.
>
> This causes the `LocationChanged<mobilelocation.locationchanged>` event to be called.

<div id="mobilelocation.stop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Stop

**Stop**

> Stops receiving location information.

## Event descriptions

<div id="mobilelocation.authorizationstatechanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.AuthorizationStateChanged

**AuthorizationStateChanged**(state As `MobileLocation.AuthorizationStates<mobilelocation.authorizationstates>`)

> Called when the authorization state changes.

<div id="mobilelocation.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Closing

**Closing**

> Called when the control's layout is closing.

<div id="mobilelocation.locationchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.LocationChanged

**LocationChanged**(latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, accuracy As `Double</api/data_types/double>`, altitude As `Double</api/data_types/double>`, altitudeAccuracy As `Double</api/data_types/double>`, course As `Double</api/data_types/double>`, speed As `Double</api/data_types/double>`, timeStamp As `DateTime</api/data_types/datetime>`)

> Called when a location update is received from the OS.
>
> Display some of the location values in labels:
>
> ``` xojo
> LatitudeLabel.Text = latitude.ToString
> LongitudeLabel.Text = longitude.ToString
> SpeedLabel.Text = speed.ToString
> ```

<div id="mobilelocation.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.Opening

**Opening**

> Called when the control's layout is opening.
>
> This is where you typically put initialization code.
>
> This example in the Opening event of a label sets its text to "Hello":
>
> ``` xojo
> Me.Text = "Hello"
> ```

<div id="mobilelocation.regionentered">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RegionEntered

**RegionEntered**(region As `MobileCircularRegion</api/mobile/mobilecircularregion>`)

> Called when the user enters a previously defined `region</api/mobile/mobilecircularregion>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This event is not currently supported for Android.
>
> </div>

<div id="mobilelocation.regionexited">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.RegionExited

**RegionExited**(region As `MobileCircularRegion</api/mobile/mobilecircularregion>`)

> Called when the user exits a previously defined `region</api/mobile/mobilecircularregion>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This event is not currently supported for Android.
>
> </div>

<div id="mobilelocation.visitchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileLocation.VisitChanged

**VisitChanged**(latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, accuracy As `Double</api/data_types/double>`, arrival As `DateTime</api/data_types/datetime>`, departure As `DateTime</api/data_types/datetime>`)

> The user has either arrived at a new location or departed from their current location.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This event is not currently supported for Android.
>
> </div>

## Notes

On iOS to test this in the Simulator, use the Debug \> Location menu to provide fake locations.

To use this class you must `enable the Location entitlement</topics/application_structure/ios/ios_apps/entitlements_and_additional_information>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Initial setup

In the Opening event handler of the screen, you will need to initialize the location like this:

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

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | All    |

<div class="seealso">

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/)

</div>
