Android下打开手机GPS设置
if (plus.os.name == "Android") { var context = plus.android.importClass("android.content.Context"); var locationManager = plus.android.importClass("android.location.LocationManager"); var main = plus.android.runtimeMainActivity(); var mainSvr = main.getSystemService(context.LOCATION_SERVICE); var gpsProvider = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER); //检查是否开启了GPS if (!gpsProvider) { var message = "为了获取您的精准位置,请开启GPS设备。"; var title = "GPS未启用"; var alertCB = function() { var Intent = plus.android.importClass("android.content.Intent"); var mIntent = new Intent(‘android.settings.LOCATION_SOURCE_SETTINGS‘); main.startActivity(mIntent); //打开GPS设置 } plus.nativeUI.alert(message, alertCB, title); } }
相关推荐
qinxu 2020-09-10
yuanbin 2020-08-24
etzt 2020-05-31
hushijiao 2020-05-17
csdnuuu 2020-05-07
AI人工智能 2020-02-28
iamBanmei 2020-01-07
xiaoxiaodedu 2020-01-05
中国软件网 2020-01-05
ASIC验证 2020-01-04
CNETNews 2020-01-03
Michael 2020-11-03
中移模组小助手 2020-10-12
83951737 2020-08-18
weiyang 2020-06-10
androidstudyroom 2020-06-03
magic00 2020-05-17