未验证 提交 21741ea7 编写于 作者: O openharmony_ci 提交者: Gitee

!21447 【轻量级 PR】:修改示例中过时 System Capability。

Merge pull request !21447 from chenyude/N/A
......@@ -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.');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册