[置頂] 兼容MIUI5和MIUI6的開啟懸浮窗設置界面
來源:程序員人生 發布時間:2014-12-18 08:53:12 閱讀次數:8986次
前1段時間項目中需要對MIUI的懸浮窗開啟設置界面進行了引導和跳轉,MIUI6中又改變了開啟懸浮窗設置的位置,在苦苦尋覓以后,找到了解決的方法,貼出來以方便大家參考和使用。

@Override
public void onClick(View view) {
//關閉提示框
MIUIFloatWindowHelpDialog.this.dismiss();
//跳轉到設置界面
try {
Intent localIntent = new Intent(
"miui.intent.action.APP_PERM_EDITOR");
localIntent
.setClassName("com.miui.securitycenter",
"com.miui.permcenter.permissions.AppPermissionsEditorActivity");
localIntent.putExtra("extra_pkgname", view
.getContext().getPackageName());
view.getContext().startActivity(localIntent);
} catch (ActivityNotFoundException localActivityNotFoundException) {
Intent intent = new Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", view.getContext().getPackageName(), null);
intent.setData(uri);
view.getContext().startActivity(intent);
}
}
小米真是開發人員的噩夢啊~~
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈