• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Applying for Location Permissions (ArkTS)
2
3## Scenario
4
5Before using the capabilities provided by [Location Kit](../../reference/apis-location-kit/js-apis-geoLocationManager.md), check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user.
6
7The system provides the following location permission:
8
9- **ohos.permission.LOCATION**: used to obtain location accurate to meters.
10
11- **ohos.permission.APPROXIMATELY\_LOCATION**: used to obtain location accurate to 5 kilometers.
12
13- **ohos.permission.LOCATION_IN_BACKGROUND**: used to obtain location while the application is running at the background.
14
15For details about the permissions required for each API of Location Kit, see [Location Kit](../../reference/apis-location-kit/js-apis-geoLocationManager.md).
16
17## How to Develop
18
191. Declare the required permission in your application's configuration file. For details, see [Requesting User Authorization](../../security/AccessToken/request-user-authorization.md).
20
212. If your application needs to access the device location when running in the foreground, declare the location permission as described in the following table.
22
23| Permission| Declarable or Not| Location Accuracy|
24| -------- | -------- | -------- |
25| ohos.permission.APPROXIMATELY_LOCATION| Yes| Location accurate to 5 kilometers.|
26| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Yes| Location accurate to meters.|
27
283. If your application needs to access the device location when running in the background, declare the location permission as follows:
29
30If your application needs to access the device location when running in the background, also request for a continuous task of the LOCATION type in addition to the permission declared in step 2.
31
32For details about how to request for a continuous task, see [Continuous Task](../../task-management/continuous-task.md)<!--Del--> and [Continuous Task Development Example](../../performance/reasonable-running-backgroundTask.md#continuous-task)<!--DelEnd-->.
33
34
35<!--RP1-->
36<!--RP1End-->
37