# How to enforce location services on Android devices?

Mobile users tend to turn off their location services in order to reduce battery consumption. This makes it difficult for organizations to locate the devices which have corporate data stored in them. An admin can enforce location services on Android devices completely over-the-air using Hexnode UEM and fetch real-time device location constantly. This is particularly helpful in situations where an organization needs to locate its devices. For instance, field workers might disable location services on the devices to avoid location monitoring. In such cases, location services can be enforced on the devices through the Hexnode UEM portal, thereby ensuring that the devices can be located.

[Retrieval of lost/stolen devices](https://www.hexnode.com/mobile-device-management/help/how-to-find-lost-android-devices-using-hexnode-mdm/) is also made easier by scanning the device location. Admins can also fetch the complete history of locations covered by the device to date. Moreover, the location will be automatically updated once the update interval is determined by applying a [location tracking](https://www.hexnode.com/mobile-device-management/help/how-to-configure-location-tracking-with-hexnode-mdm/) policy on the device.

 Notes:- This feature is supported on [Samsung Knox](https://www.samsungknox.com/en/knox-platform/supported-devices), [LG GATE](https://www.lg.com/us/business/enterprise-mobility/products), and [Kyocera business phones](https://kyoceramobile.com/business/) only.

 

 
Here’s the procedure to enforce *Location Services* on Android devices using Hexnode UEM.  **Pre-requisites:**- Devices must be enrolled with Hexnode UEM.
- Devices should be connected to the Internet.

 

 
![Allow location settings on Android](https:2023/01/Enforce_location_services_on_Android.png "Enforce location services on Android")1. Log into your Hexnode UEM portal > Navigate to **Policies** > Click on **New Policy** to create a new one or click on any policy name to edit an existing one > Enter the *Policy Name* and *Description* in the provided fields.
2. Head on to **Android** > **Restrictions** > **Basic**, Click on **Configure**.
3. Under *Allow Location Settings*, enable the following options: 
    - **GPS** – You can enable this option to let users turn ON/OFF *Location Services* on their Android devices. Disabling this option prevents users from turning ON the GPS that was previously OFF and vice-versa.
    - **Force GPS to fetch location** – You can enable this option to enforce *Location Services* on Android device(s) and prevent users from turning it OFF.
4. Navigate to **Policy Targets** > **+ Add Devices** > Select the required device(s) to which the policy needs to be associated > Click **OK**.
5. Click **Save**.
What happens at the device end?
-------------------------------

- If **GPS** and **Force GPS to fetch location** are enabled, even if location is disabled on the device, it will be turned on automatically. At any time, the **Scan Device Location** action can be performed successfully to fetch the real-time location of the device. GPS is particularly used to provide a more accurate location. Location can also be fetched without GPS but with lower accuracy.
- If **GPS** is disabled on the portal and location is disabled on the device, then **Scan Device Location** fails.

 Note: - **Scan Device Location** can be initiated if location is enabled on the device. If GPS is restricted, location will be obtained using mobile data or Wi-Fi. However, obtained location will have lower accuracy compared to location obtained using GPS.
- Location requests fail on Android 11+ devices if the ‘Background Location Access’ is denied for the Hexnode UEM/Hexnode for Work app during enrollment.
![Background Location Access on the Hexnode UEM app](https:2018/08/location-permission.jpg "Location Permission")

- Clicking on grant access redirects you to the Location Permissions page. For unattended access to the device location, select the ‘Allow all the time’ option on the page. This aids in retrieving device location details when the administrator requests it or if the device is lost.