openharmony 鸿蒙 js-apis-geolocation

2025-06-12 浏览 (1)

@ohos.geolocation (Geolocation)

The geolocation module provides a wide array of location services, including GNSS positioning, network positioning, geocoding, reverse geocoding, and geofencing.

NOTE The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. The APIs provided by this module are no longer maintained since API version 9. You are advised to use geoLocationManager. This module supports only the WGS-84 coordinate system.

Applying for Permissions

Before using basic location capabilities, 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 as described below.

The system provides the following location permissions:

  • ohos.permission.LOCATION

  • ohos.permission.APPROXIMATELY_LOCATION

  • ohos.permission.LOCATION_IN_BACKGROUND

If your application needs to access the device location information, it must first apply for required permissions. Specifically speaking:

API versions earlier than 9: Apply for ohos.permission.LOCATION.

API version 9 and later: Apply for ohos.permission.APPROXIMATELY_LOCATION, or apply for ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION. Note that ohos.permission.LOCATION cannot be applied for separately.

API VersionLocation PermissionPermission Application ResultLocation Accuracy
Earlier than 9ohos.permission.LOCATIONSuccessfulLocation accurate to meters.
9 and laterohos.permission.LOCATIONFailedNo location obtained.
9 and laterohos.permission.APPROXIMATELY_LOCATIONSuccessfulLocation accurate to 5 kilometers.
9 and laterohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATIONSuccessfulLocation accurate to meters.

To access the device location information when running in the background, an application needs to request for a continuous task of the LOCATION type. In this way, the system continues to report device location information after your application moves to the background. For details about how to request for a continuous task, see Continuous Task.

A user can grant the ohos.permission.LOCATION_IN_BACKGROUND permission for an application on the setting page. For details, see ohos.permission.LOCATION_IN_BACKGROUND.

You can declare the required permission in your application's configuration file. For details, see Requesting User Authorization.

Modules to Import

import geolocation from '@ohos.geolocation';

geolocation.on('locationChange')(deprecated)

on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void

Registers a listener for location changes with a location request initiated. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.on('locationChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value locationChange indicates a location change event.
requestLocationRequestYesLocation request.
callbackCallback<Location>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
let requestInfo:geolocation.LocationRequest = {'priority': 0x203, 'scenario': 0x300, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
let locationChange = (location:geolocation.Location):void => {
    console.info('locationChanger: data: ' + JSON.stringify(location));
};
geolocation.on('locationChange', requestInfo, locationChange);

geolocation.off('locationChange')(deprecated)

off(type: 'locationChange', callback?: Callback<Location>): void

Unregisters the listener for location changes with the corresponding location request deleted.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.off('locationChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value locationChange indicates a location change event.
callbackCallback<Location>NoCallback to unregister. The callback must be the same as that passed by the on API. If this parameter is not specified, all callbacks of the specified event type are unregistered.

Example

import geolocation from '@ohos.geolocation';
let requestInfo:geolocation.LocationRequest = {'priority': 0x203, 'scenario': 0x300, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
let locationChange = (location:geolocation.Location):void => {
    console.info('locationChanger: data: ' + JSON.stringify(location));
};
geolocation.on('locationChange', requestInfo, locationChange);
geolocation.off('locationChange', locationChange);

geolocation.on('locationServiceState')(deprecated)

on(type: 'locationServiceState', callback: Callback<boolean>): void

Registers a listener for location service status change events. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.on('locationEnabledChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value locationServiceState indicates a location service status change event.
callbackCallback<boolean>YesCallback used to return the result. The value true indicates that the location service is enabled, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
let locationServiceState = (state:boolean):void => {
    console.info('locationServiceState: ' + JSON.stringify(state));
}
geolocation.on('locationServiceState', locationServiceState);

geolocation.off('locationServiceState')(deprecated)

off(type: 'locationServiceState', callback?: Callback<boolean>): void

Unregisters the listener for location service status change events.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.off('locationEnabledChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value locationServiceState indicates a location service status change event.
callbackCallback<boolean>NoCallback to unregister. The value true indicates that the location service is enabled, and the value false indicates the opposite. The callback must be the same as that passed by the on API. If this parameter is not specified, all callbacks of the specified event type are unregistered.

Example

import geolocation from '@ohos.geolocation';
let locationServiceState = (state:boolean):void => {
    console.info('locationServiceState: state: ' + JSON.stringify(state));
}
geolocation.on('locationServiceState', locationServiceState);
geolocation.off('locationServiceState', locationServiceState);

geolocation.on('cachedGnssLocationsReporting')(deprecated)

on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void

Registers a listener for cached GNSS location reports. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.on('cachedGnssLocationsChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value cachedGnssLocationsReporting indicates reporting of cached GNSS locations.
requestCachedGnssLocationsRequestYesRequest for reporting cached GNSS location.
callbackCallback<Array<Location>>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
let cachedLocationsCb = (locations:Array<geolocation.Location>):void => {
    console.info('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations));
}
let requestInfo:geolocation.CachedGnssLocationsRequest = {'reportingPeriodSec': 10, 'wakeUpCacheQueueFull': true};
geolocation.on('cachedGnssLocationsReporting', requestInfo, cachedLocationsCb);

geolocation.off('cachedGnssLocationsReporting')(deprecated)

off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void

Unregisters the listener for cached GNSS location reports.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.off('cachedGnssLocationsChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value cachedGnssLocationsReporting indicates reporting of cached GNSS locations.
callbackCallback<Array<Location>>NoCallback to unregister. The callback must be the same as that passed by the on API. If this parameter is not specified, all callbacks of the specified event type are unregistered.

Example

import geolocation from '@ohos.geolocation';
let cachedLocationsCb = (locations:Array<geolocation.Location>):void => {
    console.info('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations));
}
let requestInfo:geolocation.CachedGnssLocationsRequest = {'reportingPeriodSec': 10, 'wakeUpCacheQueueFull': true};
geolocation.on('cachedGnssLocationsReporting', requestInfo, cachedLocationsCb);
geolocation.off('cachedGnssLocationsReporting');

geolocation.on('gnssStatusChange')(deprecated)

on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void

Registers a listener for GNSS satellite status change events. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.on('satelliteStatusChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value gnssStatusChange indicates a GNSS satellite status change.
callbackCallback<SatelliteStatusInfo>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
let gnssStatusCb = (satelliteStatusInfo:geolocation.SatelliteStatusInfo):void => {
    console.info('gnssStatusChange: ' + JSON.stringify(satelliteStatusInfo));
}
geolocation.on('gnssStatusChange', gnssStatusCb);

geolocation.off('gnssStatusChange')(deprecated)

off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void

Unregisters the listener for GNSS satellite status change events.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.off('satelliteStatusChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value gnssStatusChange indicates a GNSS satellite status change.
callbackCallback<SatelliteStatusInfo>NoCallback to unregister. The callback must be the same as that passed by the on API. If this parameter is not specified, all callbacks of the specified event type are unregistered.

Example

import geolocation from '@ohos.geolocation';
let gnssStatusCb = (satelliteStatusInfo:geolocation.SatelliteStatusInfo) => {
    console.info('gnssStatusChange: ' + JSON.stringify(satelliteStatusInfo));
}
geolocation.on('gnssStatusChange', gnssStatusCb);
geolocation.off('gnssStatusChange', gnssStatusCb);

geolocation.on('nmeaMessageChange')(deprecated)

on(type: 'nmeaMessageChange', callback: Callback<string>): void

Registers a listener for GNSS NMEA message change events. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.on('nmeaMessage').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value nmeaMessageChange indicates a GNSS NMEA message change.
callbackCallback<string>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
let nmeaCb = (str:string):void => {
    console.info('nmeaMessageChange: ' + JSON.stringify(str));
}
geolocation.on('nmeaMessageChange', nmeaCb );

geolocation.off('nmeaMessageChange')(deprecated)

off(type: 'nmeaMessageChange', callback?: Callback<string>): void

Unregisters the listener for GNSS NMEA message change events.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.off('nmeaMessage').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value nmeaMessageChange indicates a GNSS NMEA message change.
callbackCallback<string>NoCallback to unregister. The callback must be the same as that passed by the on API. If this parameter is not specified, all callbacks of the specified event type are unregistered.

Example

import geolocation from '@ohos.geolocation';
let nmeaCb = (str:string):void => {
    console.info('nmeaMessageChange: ' + JSON.stringify(str));
}
geolocation.on('nmeaMessageChange', nmeaCb);
geolocation.off('nmeaMessageChange', nmeaCb);

geolocation.on('fenceStatusChange')(deprecated)

on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void

Registers a listener for status change events of the specified geofence. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.on('gnssFenceStatusChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geofence

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value fenceStatusChange indicates a geofence status change.
requestGeofenceRequestYesGeofencing request.
wantWantAgentYesWantAgent used to receive geofence (entrance or exit) events.

Example

import geolocation from '@ohos.geolocation';
import wantAgent from '@ohos.app.ability.wantAgent';

let wantAgentInfo:wantAgent.WantAgentInfo = {
    wants: [
        {
            bundleName: "com.example.myapplication",
            abilityName: "EntryAbility",
            action: "action1"
        }
    ],
    operationType: wantAgent.OperationType.START_ABILITY,
    requestCode: 0,
    wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG],
};

wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
  let requestInfo:geolocation.GeofenceRequest = {'priority': 0x201, 'scenario': 0x301, "geofence": {"latitude": 31.12, "longitude": 121.11, "radius": 100, "expiration": 10000}};
  geolocation.on('fenceStatusChange', requestInfo, wantAgentObj);
});

geolocation.off('fenceStatusChange')(deprecated)

off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void

Unregisters the listener for status change events of the specified geofence.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.off('gnssFenceStatusChange').

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geofence

Parameters

NameTypeMandatoryDescription
typestringYesEvent type. The value fenceStatusChange indicates a geofence status change.
requestGeofenceRequestYesGeofencing request.
wantWantAgentYesWantAgent used to receive geofence (entrance or exit) events.

Example

import geolocation from '@ohos.geolocation';
import wantAgent from '@ohos.app.ability.wantAgent';

let wantAgentInfo:wantAgent.WantAgentInfo = {
    wants: [
        {
            bundleName: "com.example.myapplication",
            abilityName: "EntryAbility",
            action: "action1",
        }
    ],
    operationType: wantAgent.OperationType.START_ABILITY,
    requestCode: 0,
    wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
};

wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
  let requestInfo:geolocation.GeofenceRequest = {'priority': 0x201, 'scenario': 0x301, "geofence": {"latitude": 31.12, "longitude": 121.11, "radius": 100, "expiration": 10000}};
  geolocation.on('fenceStatusChange', requestInfo, wantAgentObj);
  geolocation.off('fenceStatusChange', requestInfo, wantAgentObj);
});

geolocation.getCurrentLocation(deprecated)

getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void

Obtains the current position. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getCurrentLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
requestCurrentLocationRequestYesLocation request.
callbackAsyncCallback<Location>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
import BusinessError from "@ohos.base"
let requestInfo:geolocation.CurrentLocationRequest = {'priority': 0x203, 'scenario': 0x300,'maxAccuracy': 0};
let locationChange = (err:BusinessError.BusinessError, location:geolocation.Location) => {
    if (err) {
        console.info('locationChanger: err=' + JSON.stringify(err));
    }
    if (location) {
        console.info('locationChanger: location=' + JSON.stringify(location));
    }
};
geolocation.getCurrentLocation(requestInfo, locationChange);

geolocation.getCurrentLocation(deprecated)

getCurrentLocation(callback: AsyncCallback<Location>): void

Obtains the current position. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getCurrentLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<Location>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
import BusinessError from "@ohos.base"
let locationChange = (err:BusinessError.BusinessError, location:geolocation.Location):void => {
    if (err) {
        console.info('locationChanger: err=' + JSON.stringify(err));
    }
    if (location) {
        console.info('locationChanger: location=' + JSON.stringify(location));
    }
};
geolocation.getCurrentLocation(locationChange);

geolocation.getCurrentLocation(deprecated)

getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>

Obtains the current position. This API uses a promise to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getCurrentLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
requestCurrentLocationRequestNoLocation request.

Return value

TypeDescription
Promise<Location>Promise used to return the result.

Example

import geolocation from '@ohos.geolocation';
let requestInfo:geolocation.CurrentLocationRequest = {'priority': 0x203, 'scenario': 0x300,'maxAccuracy': 0};
geolocation.getCurrentLocation(requestInfo).then((result) => {
    console.info('current location: ' + JSON.stringify(result));
});

geolocation.getLastLocation(deprecated)

getLastLocation(callback: AsyncCallback<Location>): void

Obtains the previous location. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getLastLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<Location>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
geolocation.getLastLocation((err, data) => {
    if (err) {
        console.info('getLastLocation: err=' + JSON.stringify(err));
    }
    if (data) {
        console.info('getLastLocation: data=' + JSON.stringify(data));
    }
});

geolocation.getLastLocation(deprecated)

getLastLocation(): Promise<Location>

Obtains the previous location. This API uses a promise to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getLastLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Return value

TypeDescription
Promise<Location>Promise used to return the result.

Example

import geolocation from '@ohos.geolocation';
geolocation.getLastLocation().then((result) => {
    console.info('getLastLocation: result: ' + JSON.stringify(result));
});

geolocation.isLocationEnabled(deprecated)

isLocationEnabled(callback: AsyncCallback<boolean>): void

Checks whether the location service is enabled. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.isLocationEnabled.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the location service is enabled, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.isLocationEnabled((err, data) => {
    if (err) {
        console.info('isLocationEnabled: err=' + JSON.stringify(err));
    }
    if (data) {
        console.info('isLocationEnabled: data=' + JSON.stringify(data));
    }
});

geolocation.isLocationEnabled(deprecated)

isLocationEnabled(): Promise<boolean>

Checks whether the location service is enabled. This API uses a promise to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.isLocationEnabled.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Return value

TypeDescription
Promise<boolean>Promise used to return the result. The value true indicates that the location service is enabled, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.isLocationEnabled().then((result) => {
    console.info('promise, isLocationEnabled: ' + JSON.stringify(result));
});

geolocation.requestEnableLocation(deprecated)

requestEnableLocation(callback: AsyncCallback<boolean>): void

Sends a request for enabling the location service. This API uses an asynchronous callback to return the result.

NOTE
This API has been discarded since API version 9. It is recommended that a dialog box be displayed in the application to request the user to go to Settings to enable the location function and specify the scenarios in which the location information will be used in the dialog box.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the location service is enabled, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.requestEnableLocation((err, data) => {
    if (err) {
        console.info('requestEnableLocation: err=' + JSON.stringify(err));
    }
    if (data) {
        console.info('requestEnableLocation: data=' + JSON.stringify(data));
    }
});

geolocation.requestEnableLocation(deprecated)

requestEnableLocation(): Promise<boolean>

Sends a request for enabling the location service. This API uses a promise to return the result.

NOTE
This API has been discarded since API version 9. It is recommended that a dialog box be displayed in the application to request the user to go to Settings to enable the location function and specify the scenarios in which the location information will be used in the dialog box.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Return value

TypeDescription
Promise<boolean>Promise used to return the result. The value true indicates that the location service is enabled, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.requestEnableLocation().then((result) => {
    console.info('promise, requestEnableLocation: ' + JSON.stringify(result));
});

geolocation.isGeoServiceAvailable(deprecated)

isGeoServiceAvailable(callback: AsyncCallback<boolean>): void

Checks whether the (reverse) geocoding service is available. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.isGeocoderAvailable.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the (reverse) geocoding service is available, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.isGeoServiceAvailable((err, data) => {
    if (err) {
        console.info('isGeoServiceAvailable: err=' + JSON.stringify(err));
    }
    if (data) {
        console.info('isGeoServiceAvailable: data=' + JSON.stringify(data));
    }
});

geolocation.isGeoServiceAvailable(deprecated)

isGeoServiceAvailable(): Promise<boolean>

Checks whether the (reverse) geocoding service is available. This API uses a promise to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.isGeocoderAvailable.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

Return value

TypeDescription
Promise<boolean>Promise used to return the result. The value true indicates that the (reverse) geocoding service is available, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.isGeoServiceAvailable().then((result) => {
    console.info('promise, isGeoServiceAvailable: ' + JSON.stringify(result));
});

geolocation.getAddressesFromLocation(deprecated)

getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void

Converts coordinates into geographic descriptions through reverse geocoding. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getAddressesFromLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

Parameters

NameTypeMandatoryDescription
requestReverseGeoCodeRequestYesReverse geocoding request.
callbackAsyncCallback<Array<GeoAddress>>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
let reverseGeocodeRequest:geolocation.ReverseGeoCodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1};
geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
    if (err) {
        console.info('getAddressesFromLocation: err=' + JSON.stringify(err));
    }
    if (data) {
        console.info('getAddressesFromLocation: data=' + JSON.stringify(data));
    }
});

geolocation.getAddressesFromLocation(deprecated)

getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>

Converts coordinates into geographic descriptions through reverse geocoding. This API uses a promise to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getAddressesFromLocation.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

Parameters

NameTypeMandatoryDescription
requestReverseGeoCodeRequestYesReverse geocoding request.

Return value

TypeDescription
Promise<Array<GeoAddress>>Promise used to return the result.

Example

import geolocation from '@ohos.geolocation';
let reverseGeocodeRequest:geolocation.ReverseGeoCodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1};
geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
    console.info('getAddressesFromLocation: ' + JSON.stringify(data));
});

geolocation.getAddressesFromLocationName(deprecated)

getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void

Converts geographic descriptions into coordinates through geocoding. This API uses an asynchronous callback to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getAddressesFromLocationName.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

Parameters

NameTypeMandatoryDescription
requestGeoCodeRequestYesGeocoding request.
callbackAsyncCallback<Array<GeoAddress>>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
let geocodeRequest:geolocation.GeoCodeRequest = {"description": "No. xx, xx Road, Pudong District, Shanghai", "maxItems": 1};
geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => {
    if (err) {
        console.info('getAddressesFromLocationName: err=' + JSON.stringify(err));
    }
    if (data) {
        console.info('getAddressesFromLocationName: data=' + JSON.stringify(data));
    }
});

geolocation.getAddressesFromLocationName(deprecated)

getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>

Converts geographic descriptions into coordinates through geocoding. This API uses a promise to return the result.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.getAddressesFromLocationName.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

Parameters

NameTypeMandatoryDescription
requestGeoCodeRequestYesGeocoding request.

Return value

TypeDescription
Promise<Array<GeoAddress>>Promise used to return the result.

Example

import geolocation from '@ohos.geolocation';
let geocodeRequest:geolocation.GeoCodeRequest = {"description": "No. xx, xx Road, Pudong District, Shanghai", "maxItems": 1};
geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => {
    console.info('getAddressesFromLocationName: ' + JSON.stringify(result));
});

geolocation.getCachedGnssLocationsSize(deprecated)

getCachedGnssLocationsSize(callback: AsyncCallback<number>): void

Obtains the number of cached GNSS locations. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.getCachedGnssLocationsSize.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<number>YesCallback used to return the result.

Example

import geolocation from '@ohos.geolocation';
geolocation.getCachedGnssLocationsSize((err, size) => {
    if (err) {
        console.info('getCachedGnssLocationsSize: err=' + JSON.stringify(err));
    }
    if (size) {
        console.info('getCachedGnssLocationsSize: size=' + JSON.stringify(size));
    }
});

geolocation.getCachedGnssLocationsSize(deprecated)

getCachedGnssLocationsSize(): Promise<number>;

Obtains the number of cached GNSS locations. This API uses a promise to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.getCachedGnssLocationsSize.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Return value

TypeDescription
Promise<number>Promise used to return the result.

Example

import geolocation from '@ohos.geolocation';
geolocation.getCachedGnssLocationsSize().then((result) => {
    console.info('promise, getCachedGnssLocationsSize: ' + JSON.stringify(result));
});

geolocation.flushCachedGnssLocations(deprecated)

flushCachedGnssLocations(callback: AsyncCallback<boolean>): void

Obtains all cached GNSS locations and clears the GNSS cache queue. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.flushCachedGnssLocations.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.flushCachedGnssLocations((err, result) => {
    if (err) {
        console.info('flushCachedGnssLocations: err=' + JSON.stringify(err));
    }
    if (result) {
        console.info('flushCachedGnssLocations: result=' + JSON.stringify(result));
    }
});

geolocation.flushCachedGnssLocations(deprecated)

flushCachedGnssLocations(): Promise<boolean>

Obtains all cached GNSS locations and clears the GNSS cache queue. This API uses a promise to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.flushCachedGnssLocations.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

Return value

TypeDescription
Promise<boolean>Promise used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
geolocation.flushCachedGnssLocations().then((result) => {
    console.info('promise, flushCachedGnssLocations: ' + JSON.stringify(result));
});

geolocation.sendCommand(deprecated)

sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void

Sends an extended command to the location subsystem. This API uses an asynchronous callback to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.sendCommand.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
commandLocationCommandYesExtended command (string) to be sent.
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
let requestInfo:geolocation.LocationCommand = {'scenario': 0x301, 'command': "command_1"};
geolocation.sendCommand(requestInfo, (err, result) => {
    if (err) {
        console.info('sendCommand: err=' + JSON.stringify(err));
    }
    if (result) {
        console.info('sendCommand: result=' + JSON.stringify(result));
    }
});

geolocation.sendCommand(deprecated)

sendCommand(command: LocationCommand): Promise<boolean>

Sends an extended command to the location subsystem. This API uses a promise to return the result.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.sendCommand.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

Parameters

NameTypeMandatoryDescription
commandLocationCommandYesExtended command (string) to be sent.

Return value

TypeDescription
Promise<boolean>Promise used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import geolocation from '@ohos.geolocation';
let requestInfo:geolocation.LocationCommand = {'scenario': 0x301, 'command': "command_1"};
geolocation.sendCommand(requestInfo).then((result) => {
    console.info('promise, sendCommand: ' + JSON.stringify(result));
});

ReverseGeoCodeRequest(deprecated)

Defines a reverse geocoding request.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.ReverseGeoCodeRequest.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

NameTypeRead OnlyOptionalDescription
localestringNoYesLanguage used for the location description. zh indicates Chinese, and en indicates English.
latitudenumberNoNoLatitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from -90 to 90.
longitudenumberNoNoLongitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from -180 to 180.
maxItemsnumberNoYesMaximum number of location records to be returned. The value must be greater than or equal to 0. A value smaller than 10 is recommended.

GeoCodeRequest(deprecated)

Defines a reverse geocoding request.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.GeoCodeRequest.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

NameTypeRead OnlyOptionalDescription
localestringNoYesLanguage used for the location description. zh indicates Chinese, and en indicates English.
descriptionstringNoNoLocation description, for example, No. xx, xx Road, Pudong New District, Shanghai.
maxItemsnumberNoYesMaximum number of location records to be returned. The value must be greater than or equal to 0. A value smaller than 10 is recommended.
minLatitudenumberNoYesMinimum latitude. This parameter is used with minLongitude, maxLatitude, and maxLongitude to specify the latitude and longitude ranges. The value ranges from -90 to 90.
minLongitudenumberNoYesMinimum longitude. The value ranges from -180 to 180.
maxLatitudenumberNoYesMaximum latitude. The value ranges from -90 to 90.
maxLongitudenumberNoYesMaximum longitude. The value ranges from -180 to 180.

GeoAddress(deprecated)

Geocoding address information.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.GeoAddress.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geocoder

NameTypeRead OnlyOptionalDescription
latitude7+numberNoYesLatitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from -90 to 90.
longitude7+numberNoYesLongitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from -180 to 180.
locale7+stringNoYesLanguage used for the location description. zh indicates Chinese, and en indicates English.
placeName7+stringNoYesLandmark of the location.
countryCode7+stringNoYesCountry code.
countryName7+stringNoYesCountry name.
administrativeArea7+stringNoYesAdministrative region name.
subAdministrativeArea7+stringNoYesSub-administrative region name.
locality7+stringNoYesLocality information.
subLocality7+stringNoYesSub-locality information.
roadName7+stringNoYesRoad name.
subRoadName7+stringNoYesAuxiliary road information.
premises7+stringNoYesHouse information.
postalCode7+stringNoYesPostal code.
phoneNumber7+stringNoYesPhone number.
addressUrl7+stringNoYesWebsite URL.
descriptions7+Array<string>NoYesAdditional descriptions.
descriptionsSize7+numberNoYesTotal number of additional descriptions. The value must be greater than or equal to 0. A value smaller than 10 is recommended.

LocationRequest(deprecated)

Defines a location request.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.LocationRequest.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameTypeRead OnlyOptionalDescription
priorityLocationRequestPriorityNoYesPriority of the location request. For details about the value range, see LocationRequestPriority.
scenarioLocationRequestScenarioNoYesScenario of the location request. For details about the value range, see LocationRequestScenario.
timeIntervalnumberNoYesTime interval at which location information is reported, in seconds. The value must be greater than 0.
distanceIntervalnumberNoYesDistance interval at which location information is reported. The value must be greater than 0, in meters.
maxAccuracynumberNoYesLocation accuracy, in meters.
This parameter is valid only when the precise location function is enabled (both the ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION permissions are granted), and is invalid when the approximate location function is enabled (only the ohos.permission.APPROXIMATELY_LOCATION permission is enabled).
The specified value must be greater than or equal to 0. The default value is 0.
If scenario is set to NAVIGATION, TRAJECTORY_TRACKING, or CAR_HAILING or priority is set to ACCURACY, you are advised to set maxAccuracy to a value greater than 10.
If scenario is set to DAILY_LIFE_SERVICE or NO_POWER or priority is set to LOW_POWER or FIRST_FIX, you are advised to set maxAccuracy to a value greater than 100.

CurrentLocationRequest(deprecated)

Defines a location request.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.CurrentLocationRequest.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameTypeRead OnlyOptionalDescription
priorityLocationRequestPriorityNoYesPriority of the location request. For details about the value range, see LocationRequestPriority.
scenarioLocationRequestScenarioNoYesScenario of the location request. For details about the value range, see LocationRequestScenario.
maxAccuracynumberNoYesLocation accuracy, in meters.
This parameter is valid only when the precise location function is enabled (both the ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION permissions are granted), and is invalid when the approximate location function is enabled (only the ohos.permission.APPROXIMATELY_LOCATION permission is enabled).
The specified value must be greater than or equal to 0. The default value is 0.
If scenario is set to NAVIGATION, TRAJECTORY_TRACKING, or CAR_HAILING or priority is set to ACCURACY, you are advised to set maxAccuracy to a value greater than 10.
If scenario is set to DAILY_LIFE_SERVICE or NO_POWER or priority is set to LOW_POWER or FIRST_FIX, you are advised to set maxAccuracy to a value greater than 100.
timeoutMsnumberNoYesTimeout duration, in milliseconds. The minimum value is 1000. The value must be greater than or equal to 1000.

SatelliteStatusInfo(deprecated)

Defines the satellite status information.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.SatelliteStatusInfo.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

NameTypeRead OnlyOptionalDescription
satellitesNumbernumberNoNoNumber of satellites. The value must be greater than or equal to 0.
satelliteIdsArray<number>NoNoArray of satellite IDs. The value must be greater than or equal to 0.
carrierToNoiseDensitysArray<number>NoNoCarrier-to-noise density ratio, that is, cn0. The value must be greater than 0.
altitudesArray<number>NoNoSatellite altitude angle information. The value ranges from -90 to 90, in degrees.
azimuthsArray<number>NoNoAzimuth information. The value ranges from 0 to 360, in degrees.
carrierFrequenciesArray<number>NoNoCarrier frequency. The value must be greater than or equal to 0, in Hz.

CachedGnssLocationsRequest(deprecated)

Represents a request for reporting cached GNSS locations.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.CachedGnssLocationsRequest.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Gnss

NameTypeRead OnlyOptionalDescription
reportingPeriodSecnumberNoNoInterval for reporting the cached GNSS locations, in milliseconds. The value must be greater than 0.
wakeUpCacheQueueFullbooleanNoNotrue: reports the cached GNSS locations to the application when the cache queue is full.
false: discards the cached GNSS locations when the cache queue is full.

Geofence(deprecated)

Defines a GNSS geofence. Currently, only circular geofences are supported.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.Geofence.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geofence

NameTypeRead OnlyOptionalDescription
latitudenumberNoNoLatitude information. The value ranges from -90 to 90.
longitudenumberNoNoLongitude information. The value ranges from -180 to 180.
radiusnumberNoNoRadius of a circular geofence. The value must be greater than 0, in meters.
expirationnumberNoNoExpiration period of a geofence, in milliseconds. The value must be greater than 0.

GeofenceRequest(deprecated)

Defines a geofence request.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.GeofenceRequest.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Geofence

NameTypeRead OnlyOptionalDescription
priorityLocationRequestPriorityNoNoPriority of the location information.
scenarioLocationRequestScenarioNoNoLocation scenario.
geofenceGeofenceNoNoGeofence information.

LocationCommand(deprecated)

Defines a location command.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.LocationCommand.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameTypeRead OnlyOptionalDescription
scenarioLocationRequestScenarioNoNoLocation scenario.
commandstringNoNoExtended command, in the string format.

Location(deprecated)

Defines location information.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.Location.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameTypeRead OnlyOptionalDescription
latitude7+numberNoNoLatitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from -90 to 90.
longitude7+numberNoNoLongitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from -180 to 180.
altitude7+numberNoNoLocation altitude, in meters.
accuracy7+numberNoNoLocation accuracy, in meters.
speed7+numberNoNoSpeed, in m/s.
timeStamp7+numberNoNoLocation timestamp in the UTC format.
direction7+numberNoNoDirection information. The value ranges from 0 to 360, in degrees.
timeSinceBoot7+numberNoNoLocation timestamp since boot.
additions7+Array<string>NoYesAdditional description.
additionSize7+numberNoYesNumber of additional descriptions. The value must be greater than or equal to 0.

LocationPrivacyType(deprecated)

Defines the privacy statement type.

NOTE
This API is supported since API version 8. This API is deprecated since API version 9. You are advised to use geoLocationManager.LocationPrivacyType, which is available only for system applications.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameValueDescription
OTHERS0Other scenarios. Reserved field.
STARTUP1Privacy statement displayed in the startup wizard.
CORE_LOCATION2Privacy statement displayed when enabling the location service.

LocationRequestPriority(deprecated)

Sets the priority of a location request.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.LocationRequestPriority.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameValueDescription
UNSET0x200Priority unspecified.
If this option is used, LocationRequestPriority is invalid.
ACCURACY0x201Location accuracy preferred.
This policy mainly uses the GNSS positioning technology. In an open area, the technology can achieve the meter-level location accuracy, depending on the hardware performance of the device. However, in a shielded environment, the location accuracy may significantly decrease.
LOW_POWER0x202Power efficiency preferred.
This policy mainly uses the base station positioning, WLAN positioning, and Bluetooth positioning technologies to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption when your application does not require high location accuracy or when base stations, visible WLANs, and Bluetooth devices are densely distributed.
FIRST_FIX0x203Fast location preferred. Use this option if you want to obtain a location as fast as possible.
This policy uses the GNSS positioning, base station positioning, WLAN positioning, and Bluetooth positioning technologies simultaneously to obtain the device location in both the indoor and outdoor scenarios. When all positioning technologies provide a location result, the system provides the most accurate location result for your application. It can lead to significant hardware resource consumption and power consumption.

LocationRequestScenario(deprecated)

Defines the location scenario in a location request.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.LocationRequestScenario.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameValueDescription
UNSET0x300Scenario unspecified.
If this option is used, LocationRequestScenario is invalid.
NAVIGATION0x301Navigation scenario.
This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking.
In this scenario, GNSS positioning is used to provide location services to ensure the optimal location accuracy of the system.
The location result is reported at a minimum interval of 1 second by default.
TRAJECTORY_TRACKING0x302Trajectory tracking scenario.
This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy.
The location result is reported at a minimum interval of 1 second by default.
CAR_HAILING0x303Ride hailing scenario.
This option is applicable when your application needs to obtain the current location of a user who is hailing a taxi.
The location result is reported at a minimum interval of 1 second by default.
DAILY_LIFE_SERVICE0x304Daily life service scenario.
This option is applicable when your application only needs the approximate user location for recommendations and push notifications in scenarios such as when the user is browsing news, shopping online, and ordering food.
The location result is reported at a minimum interval of 1 second by default.
NO_POWER0x305Power efficiency scenario.
This option is applicable when your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.

GeoLocationErrorCode(deprecated)

Enumerates error codes of the location service.

NOTE
This API is deprecated since API version 9. You are advised to use geoLocationManager.

Required permissions: ohos.permission.LOCATION

System capability: SystemCapability.Location.Location.Core

NameValueDescription
INPUT_PARAMS_ERROR7+101Incorrect input parameters.
REVERSE_GEOCODE_ERROR7+102Failed to call the reverse geocoding API.
GEOCODE_ERROR7+103Failed to call the geocoding API.
LOCATOR_ERROR7+104Failed to obtain the location.
LOCATION_SWITCH_ERROR7+105Failed to change the location service switch.
LAST_KNOWN_LOCATION_ERROR7+106Failed to obtain the previous location.
LOCATION_REQUEST_TIMEOUT_ERROR7+107Failed to obtain the location within the specified time.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Location Kit

harmony 鸿蒙Location

harmony 鸿蒙Location_BasicInfo

harmony 鸿蒙Location Kit Error Codes

harmony 鸿蒙@ohos.app.ability.FenceExtensionAbility (FenceExtensionAbility)

harmony 鸿蒙@ohos.app.ability.FenceExtensionContext (FenceExtensionContext) (System API)

harmony 鸿蒙@ohos.app.ability.FenceExtensionContext (FenceExtensionContext)

harmony 鸿蒙@ohos.geoLocationManager (Geolocation Manager) (System API)

harmony 鸿蒙@ohos.geoLocationManager (Geolocation Manager)

harmony 鸿蒙@system.geolocation (Geolocation)

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/OTEpup