EasyPusher "permission denied for window type 2006" error handling

In a previous version, EasyPusher supported the function of dynamically obtaining permissions at the request of the customer, and changed the targetSdkVersion to 23. Later, it was found that it would crash on some devices. After collecting logs in the background, the error was found as follows:

write picture description here

It turns out that some mobile phones have restricted the VIEW format of TYPE_SYSTEM_OVERLAY in the Android 6.0 system. Only system-level applications have permission to create such windows. After all, such windows can not be restricted by users. For example, after the app exits, the window can continue. exhibit.

In order to do the background upload function, EasyPusher requires that there must be a permanent window for the camera to use (otherwise the camera will not call back the video stream), even if the APP returns to the background, it must continue to exist. Therefore, the TYPE_SYSTEM_OVERLAY level mentioned above must be used. VIEW.

If the targetSdkVersion is set to 23 and above, the system will think that the developer has already adapted it on the 23 system, and the system thinks that the APP has been compatible with this floating window. Therefore, the APP is restricted according to the normal 6.0 permission policy. , then trying to open such a window will report an error.

If the targetSdkVersion is set to 22 or below, the system will think that the developer has only done adaptation on the system of 22 or below. Assuming that the APP is installed on the 6.0 machine, the system will also limit the permissions of the APP in a compatible mode. At this time, the creation permission of the floating frame is let go. So there will be no problem with the APP.

Therefore, change the targetSdkVersion back to 22, and the error will no longer be reported.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325407475&siteId=291194637