增加搜索插件
This commit is contained in:
@@ -121,21 +121,38 @@ const goPermission = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转授权
|
||||
const jumpAuthPermission = () => {
|
||||
|
||||
// 跳转授权按钮
|
||||
const jumpAuthPermission=()=>{
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var Intent = plus.android.importClass('android.content.Intent');
|
||||
var Uri = plus.android.importClass('android.net.Uri');
|
||||
var Build = plus.android.importClass('android.os.Build');
|
||||
var Settings = plus.android.importClass('android.provider.Settings');
|
||||
var PackageManager = plus.android.importClass('android.content.pm.PackageManager');
|
||||
var pkg = main.getPackageName();
|
||||
var intent = new Intent('android.settings.APPLICATION_DETAILS_SETTINGS');
|
||||
intent.setData(Uri.parse('package:' + pkg));
|
||||
main.startActivity(intent);
|
||||
setTimeout(()=>{
|
||||
uni.reLaunch({
|
||||
url: '/pages/loading/loading',
|
||||
});
|
||||
},500)
|
||||
}
|
||||
|
||||
var intent = new Intent();
|
||||
// 跳转授权
|
||||
const jumpAuthPermission2 = () => {
|
||||
|
||||
let main = plus.android.runtimeMainActivity();
|
||||
let Intent = plus.android.importClass('android.content.Intent');
|
||||
let Uri = plus.android.importClass('android.net.Uri');
|
||||
let Build = plus.android.importClass('android.os.Build');
|
||||
let Settings = plus.android.importClass('android.provider.Settings');
|
||||
let PackageManager = plus.android.importClass('android.content.pm.PackageManager');
|
||||
let pkg = main.getPackageName();
|
||||
|
||||
let intent = new Intent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
try {
|
||||
showAlert(Build.VERSION.SDK_INT)
|
||||
// 尝试直接跳转到存储权限设置(Android 13+ 支持)
|
||||
if (Build.VERSION.SDK_INT >= 33) {
|
||||
// Android 13+ 尝试直接打开存储权限页面
|
||||
@@ -148,11 +165,12 @@ const jumpAuthPermission = () => {
|
||||
else if (Build.VERSION.SDK_INT >= 30) {
|
||||
intent.setAction(Settings.ACTION_MANAGE_APP_PERMISSIONS);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, pkg);
|
||||
|
||||
}
|
||||
// Android 6.0-10 跳转到应用详情页(用户需手动点击权限)
|
||||
else if (Build.VERSION.SDK_INT >= 23) {
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
var uri = Uri.fromParts("package", pkg, null);
|
||||
let uri = Uri.fromParts("package", pkg, null);
|
||||
intent.setData(uri);
|
||||
}
|
||||
// 低版本系统
|
||||
@@ -160,6 +178,8 @@ const jumpAuthPermission = () => {
|
||||
intent.setAction(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
|
||||
}
|
||||
|
||||
showAlert("main=>"+main)
|
||||
showAlert("intent=>"+intent)
|
||||
main.startActivity(intent);
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -169,9 +189,10 @@ const jumpAuthPermission = () => {
|
||||
}, 1000)
|
||||
|
||||
} catch (e) {
|
||||
showAlert(e)
|
||||
// 异常情况下降级处理
|
||||
console.error("跳转存储权限页面失败,使用备用方案", e);
|
||||
var fallbackIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
let fallbackIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
fallbackIntent.setData(Uri.parse('package:' + pkg));
|
||||
fallbackIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
main.startActivity(fallbackIntent);
|
||||
|
||||
Reference in New Issue
Block a user