通过intent,然后传递自己的应用ID,这样就可以跳到自己的应用设置页,否则就跳到随机一个设置页。
PackageManager pm = context.getPackageManager();
PackageInfo info = null;
try {
info = pm.getPackageInfo(context.getPackageName(), 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
Intent i = new Intent("miui.intent.action.APP_PERM_EDITOR");
i.setClassName("com.android.settings", "com.miui.securitycenter.permission.AppPermissionsEditor");
i.putExtra("extra_package_uid", info.applicationInfo.uid);
try {
context.startActivity(i);
} catch (Exception e) {
Toast.makeText(this.getContext(), "只有MIUI才可以设置哦", Toast.LENGTH_SHORT).show();