"Permit drawing over other apps" pop up - how to disable it?

I “detached” the Expo client as I had to use react-native link. However, when I test the app in the Genymotion emulator and build & run the apk from the Android Studio, I get a pop up that says Please enable "Permit drawing over other apps".

Why is the pop up showing? Is this something of a requirement for the Expo client in certain Android versions in Production too? Or is it specifically occurring only in the development environment? This would be a deal breaker from a user experience point of view in a production scenario.

5 Likes

Having the same question

Once you detach, you gain full control over what permissions your app requires. You will need to remove the SYSTEM_ALERT_WINDOW permission. (I believe this is only used in the standard expo app to display progress while you load an updated version of your experience while developing)

After reading Release APK Permissions, we were finally was able to remove the permissions we needed. The one in question for you is:

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

But, the popup still shows up in the emulator and on the test device. Will update when figured out a proper fix for this.

2 Likes

Even though SYSTEM_ALERT_WINDOW has been removed, the app is still asking for permission to “Permit drawing over other apps”, only when running in the emulator. However, it doesn’t seem to affect the release version.

Here is the error generated in AndroidStudio (detached to ExpoKit):

            --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
            Process: com.modenero.***, PID: 23335
            android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@8557fd1 -- permission denied for window type 2003
                at android.view.ViewRootImpl.setView(ViewRootImpl.java:703)
                at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342)
                at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
                at android.app.Dialog.show(Dialog.java:322)
                at com.facebook.react.devsupport.DevSupportManagerImpl$4.run(DevSupportManagerImpl.java:375)
                at android.os.Handler.handleCallback(Handler.java:751)
                at android.os.Handler.dispatchMessage(Handler.java:95)
                at android.os.Looper.loop(Looper.java:154)
                at android.app.ActivityThread.main(ActivityThread.java:6119)
                at java.lang.reflect.Method.invoke(Native Method)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

And a few screenshots for good measure:

2 Likes

I’ve been seeing that window pop alert in genymotion emulator too.

You can enable this permission for the emulator by running the following from a console:

adb shell pm grant host.exp.exponent android.permission.SYSTEM_ALERT_WINDOW

See here for more info: android - How do I use adb grant or adb revoke? - Stack Overflow