收藏学习
- 跳转到miui的权限管理页面
private void gotoMiuiPermission() {
Intent i = new Intent("miui.intent.action.APP_PERM_EDITOR");
ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");
i.setComponent(componentName);
i.putExtra("extra_pkgname", getPackageName());
try {
startActivity(i);
} catch (Exception e) {
e.printStackTrace();
gotoMeizuPermission();
}
}
- 跳转到魅族的权限管理系统
private void gotoMeizuPermission() {
Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra("packageName", BuildConfig.APPLICATION_ID);
try {
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
gotoHuaweiPermission();
}
}
3.华为的权限管理页面
private void gotoHuaweiPermission() {
try {
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ComponentName comp = new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity");//华为权限管理
intent.setComponent(comp);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
startActivity(getAppDetailSettingIntent());
}
}
4.获取应用详情页面intent
private Intent getAppDetailSettingIntent() {
Intent localIntent = new Intent();
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (Build.VERSION.SDK_INT >= 9) {
localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
localIntent.setData(Uri.fromParts("package", getPackageName(), null));
} else if (Build.VERSION.SDK_INT <= 8) {
localIntent.setAction(Intent.ACTION_VIEW);
localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
localIntent.putExtra("com.android.settings.ApplicationPkgName", getPackageName());
}
return localIntent;
}