未验证 提交 c59d1a7a 编写于 作者: C chenyude 提交者: Gitee

修改过时 System Capability。

Signed-off-by: Nchenyude <chenyude@huawei.com>
上级 8e399021
......@@ -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.
先完成此消息的编辑!
想要评论请 注册