function getAltitudeFromAndroidSystem() {
let LocationManager = plus.android.importClass("android.location.LocationManager");
let Context = plus.android.importClass("android.content.Context");
let main = plus.android.runtimeMainActivity();
let locationManager = main.getSystemService(Context.LOCATION_SERVICE);
let location = locationManager.getLastKnownLocation(LocationManager
.GPS_PROVIDER);
let altitude = plus.android.invoke(location, "getAltitude");
let hasAltitude = plus.android.invoke(location, "hasAltitude");
plus.android.deleteObject(LocationManager);
plus.android.deleteObject(Context);
if(hasAltitude) {
return altitude;
} else {
return 0;
}
}

__ju__
- 发布:2024-01-02 18:10
- 更新:2024-01-02 18:10
- 阅读:310
安卓系统获取海拔高度
分类:uni-app
0 个评论
要回复文章请先登录或注册