Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you remove the required SYSTEM_ALERT_WINDOW permission for release version of a React Native Android app?

From what I've read, React Native requires the permission android.permission.SYSTEM_ALERT_WINDOW to enable its developer interface in debug mode. However, when publishing a release, this permission is still included, which causes users to freak out (since it says "permission to draw over other apps").

I can manually remove the permission in AndroidManifest.xml, but that will break the app when I'm in development mode -- and that's not something I want to do every time I release a new version.

Is there a way to disable the permission for only release versions of the app?

like image 851
Dan Leveille Avatar asked May 12 '16 06:05

Dan Leveille


People also ask

How do I remove permissions in react native app?

One of them is the READ_PHONE_STATE, a permission that reads data that most users will not want to give and they might not install the app because of that. The simple way to remove this type of permission, is by deleting its xml code line from the original Android Manifest file in android/app/src/main .

What is Read_phone_state permission?

android. permission. READ_PHONE_STATE - You must ask the end user to grant this permission.) Allows read only access to the phone's state, and is used to determine the status of any ongoing calls. You need this permission so you can verify that your end user receives a phone call from Telesign.


1 Answers

There is a solution for Android Studio, I hope react-native have the same functions:

You can have two separate AndroidManifest.xml for release and debug versions.

Debug manifest should be located in ${projectPath}\src\debug\AndroidManifest.xml
Release manifest in ${projectPath}\src\main\AndroidManifest.xml

You can put android.permission.SYSTEM_ALERT_WINDOW only in debug manifest and don't add this into release.

like image 166
Artem Mostyaev Avatar answered Nov 15 '22 12:11

Artem Mostyaev