赞
踩
// #ifdef APP-PLUS const platform = uni.getSystemInfoSync().platform if (platform === 'android') { var main = plus.android.runtimeMainActivity(); //获取activity var pkName = main.getPackageName(); var Intent = plus.android.importClass('android.content.Intent'); var Settings = plus.android.importClass('android.provider.Settings'); var Uri = plus.android.importClass('android.net.Uri'); var packageUri = Uri.parse("package:" + pkName); var intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, // 应用省电策略 packageUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); main.startActivity(intent); } // #endif
var main = plus.android.runtimeMainActivity(); //获取activity
var Intent = plus.android.importClass('android.content.Intent');
var Settings = plus.android.importClass('android.provider.Settings');
var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);//可设置表中所有Action字段
main.startActivity(intent);
var app = plus.ios.invoke("UIApplication", "sharedApplication");
var setting = plus.ios.invoke("NSURL", "URLWithString:", "app-settings:");
plus.ios.invoke(app, "openURL:", setting);
plus.ios.deleteObject(setting);
plus.ios.deleteObject(app);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。