diff --git a/zh-cn/application-dev/reference/apis/js-apis-syscap.md b/zh-cn/application-dev/reference/apis/js-apis-syscap.md index 18d5bd486c8d35ffd0eac4f31dc95bbb5e7aed32..f63411f400a84ddef75a99ee5a994c8ae160b68a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-syscap.md +++ b/zh-cn/application-dev/reference/apis/js-apis-syscap.md @@ -29,12 +29,17 @@ canIUse(syscap: string): boolean **示例:** ```js -import geolocation from '@ohos.geolocation' +import geoLocationManager from '@ohos.geoLocationManager' -const isLocationAvailable = canIUse('SystemCapability.Location.Location'); +const isLocationAvailable = canIUse('SystemCapability.Location.Location.Core'); if (isLocationAvailable) { - geolocation.getCurrentLocation((location) => { - console.log(location.latitude, location.longitue); + geoLocationManager.getCurrentLocation((err, location) => { + if (err) { + console.log('err=' + JSON.stringify(err)); + } + if (location) { + console.log('location=' + JSON.stringify(location)); + } }); } else { console.log('Location not by this device.');