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

@Override
public void onClick(View view) {
//關(guān)閉提示框
MIUIFloatWindowHelpDialog.this.dismiss();
//跳轉(zhuǎn)到設(shè)置界面
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);
}
}
小米真是開發(fā)人員的噩夢(mèng)啊~~
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)