我是本机的新手,我希望获得设备的当前位置。我怎么能通过使用Geolocation这样做。我已经完成了本地文档的反应。但是我仍然无法获得该位置。
这是我的代码
我在AndroidManifest.xml中添加了以下行:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
这是我的代码到目前为止控制当前位置
const location = Geolocation.getCurrentPosition();
console.log("location", location)
(我在android中构建我的应用程序)
答案 0 :(得分:0)
Geolocation.getCurrentPosition
是异步的,因此location info is returned in callback:
Geolocation.getCurrentPosition(location => console.log('location', location));
答案 1 :(得分:0)