Android Dialog set TYPE_SYSTEM_ALERT some mobile phones can not display the problem


  When the dialog is initialized, set
mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

The dialog box can always be displayed on top of the windows of other applications, that is to say, the dialog is always on the top layer and is always visible to the user, that is to say, the dialog is still there after the user presses home.
  Doing so requires permission


<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />


  However, some mobile phones have modified the bottom layer (Xiaomi, Meizu, etc.), and the system will deny this permission by default.


Solution:
By setting type to TYPE_TOAST, you can bypass the check
mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326597125&siteId=291194637