Android M detect if permission dialog is visible
问题 How can I determine programmatically if a permission dialog is visible to the user so I know what to do in this case? 回答1: @Override protected void onStart() { super.onStart(); ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ComponentName cn = am.getRunningTasks(1).get(0).topActivity; if ("com.android.packageinstaller.permission.ui.GrantPermissionsActivity".equals(cn.getClassName())){ //permission dialog is displayed } }` ` 回答2: Permission dialog is an