How to check, detect or identify the settings component screen overlay or any feature available or not

断了今生、忘了曾经 提交于 2020-12-07 08:15:40

问题


My android app need display over other app permission which is screen overlay permission.

  • Settings.ACTION_MANAGE_OVERLAY_PERMISSION
  • SYSTEM_ALERT_WINDOW

In normal android OS device i can give permission easily using this code.

if (!Settings.canDrawOverlays(this) && !Constant.IsOverlayPermissionGiven) {

                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                        Uri.parse("package:" + getPackageName()));
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                startActivityForResult(intent, REQUEST_CODE);
                handler.postDelayed(checkSettingOn, 200);
                return false;
            } else {
                return true;
            }

But in Android Go edition device permission screen displaying the message of "This feature is not available" with the caution of "This feature has been turned off because it slows down your phone"

How to get the information about the feature is available or not programmatically ? How to bypass the permission screen which device don't have screen overlay feature?

来源:https://stackoverflow.com/questions/63938787/how-to-check-detect-or-identify-the-settings-component-screen-overlay-or-any-fe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!