1 # Access Token Changelog 2 ## cl.access_token.1 Behavior Change When Location Permission Is Requested by requestPermissionsFromUser 3 4 **Access Level** 5 6 Public 7 8 **Reason for Change** 9 10 This change is a non-compatible change. According to privacy protection requirements, the [ohos.permission.APPROXIMATELY_LOCATION](../../../application-dev/security/permission-list.md#ohospermissionapproximately_location) permission must be requested together with the [ohos.permission.LOCATION_IN_BACKGROUND](../../../application-dev/security/permission-list.md#ohospermissionlocation_in_background) or [ohos.permission.LOCATION](../../../application-dev/security/permission-list.md#ohospermissionlocation) permission. 11 12 **Change Impact** 13 14 Before the change, when [requestPermissionsFromUser](../../../application-dev/reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) is called to request the location permission, an authorization dialog box will be displayed in either of the following cases: 15 16 - The **ohos.permission.LOCATION_IN_BACKGROUND** permission is requested without the **ohos.permission.APPROXIMATELY_LOCATION** permission. 17 18 - The **ohos.permission.LOCATION_IN_BACKGROUND** and **ohos.permission.LOCATION** permissions are requested without the **ohos.permission.APPROXIMATELY_LOCATION** permission. 19 20 21 After the change, the authorization dialog box will not be displayed in the preceding two cases. The **ohos.permission.APPROXIMATELY_LOCATION** permission must be requested together with the **ohos.permission.LOCATION_IN_BACKGROUND** or **ohos.permission.LOCATION** permission. 22 23 **Change Since** 24 25 OpenHarmony SDK 4.1.1.5 26 27 **Key API/Component Changes** 28 29 The **ohos.permission.APPROXIMATELY_LOCATION** permission must also be requested when the **ohos.permission.LOCATION_IN_BACKGROUND** or **ohos.permission.LOCATION** permission is requested by using **requestPermissionsFromUser** in @ohos.abilityAccessCtrl.d.ts. 30 31 **Affected APIs** 32 33 | File| API| 34 | -------- | -------- | 35 | @ohos.geolocation.d.ts | geolocation.on('locationChange') | 36 | @ohos.geolocation.d.ts | geolocation.off('locationChange') | 37 | @ohos.geolocation.d.ts | geolocation.on('locationServiceState') | 38 | @ohos.geolocation.d.ts | geolocation.off('locationServiceState') | 39 | @ohos.geolocation.d.ts | geolocation.on('cachedGnssLocationsReporting') | 40 | @ohos.geolocation.d.ts | geolocation.off('cachedGnssLocationsReporting') | 41 | @ohos.geolocation.d.ts | geolocation.on('gnssStatusChange') | 42 | @ohos.geolocation.d.ts | geolocation.off('gnssStatusChange') | 43 | @ohos.geolocation.d.ts | geolocation.on('nmeaMessageChange') | 44 | @ohos.geolocation.d.ts | geolocation.off('nmeaMessageChange') | 45 | @ohos.geolocation.d.ts | geolocation.on('fenceStatusChange') | 46 | @ohos.geolocation.d.ts | geolocation.off('fenceStatusChange') | 47 | @ohos.geolocation.d.ts | geolocation.getCurrentLocation | 48 | @ohos.geolocation.d.ts | geolocation.getLastLocation | 49 | @ohos.geolocation.d.ts | geolocation.isLocationEnabled | 50 | @ohos.geolocation.d.ts | geolocation.requestEnableLocation | 51 | @ohos.geolocation.d.ts | geolocation.isGeoServiceAvailable | 52 | @ohos.geolocation.d.ts | geolocation.getAddressesFromLocation | 53 | @ohos.geolocation.d.ts | geolocation.getAddressesFromLocationName | 54 | @ohos.geolocation.d.ts | geolocation.getCachedGnssLocationsSize | 55 | @ohos.geolocation.d.ts | geolocation.flushCachedGnssLocations | 56 | @ohos.geolocation.d.ts | geolocation.sendCommand | 57 | @ohos.geolocation.d.ts | SatelliteStatusInfo | 58 | @ohos.geolocation.d.ts | CachedGnssLocationsRequest | 59 | @ohos.geolocation.d.ts | GeofenceRequest | 60 | @ohos.geolocation.d.ts | Geofence | 61 | @ohos.geolocation.d.ts | ReverseGeoCodeRequest | 62 | @ohos.geolocation.d.ts | GeoCodeRequest | 63 | @ohos.geolocation.d.ts | GeoAddress | 64 | @ohos.geolocation.d.ts | LocationRequest | 65 | @ohos.geolocation.d.ts | CurrentLocationRequest | 66 | @ohos.geolocation.d.ts | Location | 67 | @ohos.geoLocationManager.d.ts | geoLocationManager.on('nmeaMessage') | 68 | @ohos.geoLocationManager.d.ts | geoLocationManager.off('nmeaMessage') | 69 | @ohos.geoLocationManager.d.ts | geoLocationManager.on('locatingRequiredDataChange') | 70 | @ohos.geoLocationManager.d.ts | geoLocationManager.off('locatingRequiredDataChange') | 71 | @ohos.geoLocationManager.d.ts | geoLocationManager.getLocatingRequiredData | 72 | @ohos.bluetooth.d.ts | bluetooth.startBluetoothDiscovery | 73 | @ohos.bluetooth.d.ts | startBLEScan | 74 | @ohos.bluetoothManager.d.ts | bluetoothManager.startBluetoothDiscovery | 75 | @ohos.bluetoothManager.d.ts | startBLEScan | 76 | @ohos.telephony.observer.d.ts | observer.on('cellInfoChange') | 77 | @ohos.telephony.radio.d.ts | radio.sendUpdateCellLocationRequest | 78 | @ohos.telephony.radio.d.ts | radio.getCellInformation | 79 | @system.geolocation.d.ts | GetLocationOption | 80 | @system.geolocation.d.ts | SubscribeLocationOption | 81 | @system.geolocation.d.ts | geolocation.getLocation | 82 | @system.geolocation.d.ts | geolocation.subscribe | 83 | @system.geolocation.d.ts | geolocation.unsubscribe | 84 | @ohos.wifi.d.ts | wifi.scan | 85 | @ohos.wifi.d.ts | wifi.getScanInfos | 86 | @ohos.wifi.d.ts | wifi.getDeviceConfigs | 87 | @ohos.wifi.d.ts | wifi.getStations | 88 | @ohos.wifi.d.ts | wifi.getCurrentGroup | 89 | @ohos.wifi.d.ts | wifi.getP2pPeerDevices | 90 | @ohos.wifi.d.ts | wifi.p2pConnect | 91 | @ohos.wifi.d.ts | wifi.startDiscoverDevices | 92 | @ohos.wifi.d.ts | wifi.on('p2pDeviceChange') | 93 | @ohos.wifi.d.ts | wifi.off('p2pDeviceChange') | 94 | @ohos.wifi.d.ts | wifi.on('p2pPeerDeviceChange') | 95 | @ohos.wifi.d.ts | wifi.off('p2pPeerDeviceChange') | 96 | @ohos.wifiManager.d.ts | wifiManager.scan | 97 | @ohos.wifiManager.d.ts | wifiManager.getScanResults | 98 | @ohos.wifiManager.d.ts | wifiManager.getScanResultsSync | 99 | @ohos.wifiManager.d.ts | wifiManager.getCandidateConfigs | 100 | @ohos.wifiManager.d.ts | wifiManager.getDeviceConfigs | 101 | @ohos.wifiManager.d.ts | wifiManager.getStations | 102 | @ohos.wifiManager.d.ts | wifiManager.getCurrentGroup | 103 | @ohos.wifiManager.d.ts | wifiManager.getP2pPeerDevices | 104 | @ohos.wifiManager.d.ts | wifiManager.p2pConnect | 105 | @ohos.wifiManager.d.ts | wifiManager.startDiscoverDevices | 106 | @ohos.wifiManager.d.ts | wifiManager.getP2pGroups | 107 | @ohos.wifiManager.d.ts | wifiManager.on('p2pDeviceChange') | 108 | @ohos.wifiManager.d.ts | wifiManager.off('p2pDeviceChange') | 109 | @ohos.wifiManager.d.ts | wifiManager.on('p2pPeerDeviceChange') | 110 | @ohos.wifiManager.d.ts | wifiManager.off('p2pPeerDeviceChange') | 111 112 **Adaptation Guide** 113 114 Refer to [requestPermissionsFromUser](../../../application-dev/reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) when modifying **EntryAbility.ets** and importing **GlobalThis**. 115 116 ```ts 117 let context: common.UIAbilityContext = GlobalThis.getInstance().getContext('context'); 118 atManager.requestPermissionsFromUser(context, ['ohos.permission.APPROXIMATELY_LOCATION', 'ohos.permission.LOCATION', 'ohos.permission.LOCATION_IN_BACKGROUND']).then((data) => { 119 console.info('data:' + JSON.stringify(data)); 120 }).catch((err: BusinessError) => { 121 console.info('data:' + JSON.stringify(err)); 122 }) 123 ``` 124