Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native - Keeps adding android.permission.READ_PHONE_STATE

My app doesn't need to read phone state so I'd like to remove the permission from my react native app.

Every time i delete it from everywhere in the project, it is re-added again when I run ./gradlew assembleRelease

How do I get it to stop adding it in?

like image 704
BeniaminoBaggins Avatar asked Apr 10 '17 06:04

BeniaminoBaggins


People also ask

What is Read_phone_state permission?

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. android.

What does Android permission Use_full_screen_intent mean?

Apps that target Android 10 or higher and use notifications with fullscreen intents must request the USE_FULL_SCREEN_INTENT permission in their app's manifest file. This is a normal permission, so the system automatically grants it to the requesting app.

Has location permission react native?

Geolocation is enabled by default when you create a project with react-native init . In order to enable geolocation in the background, you need to include the 'NSLocationAlwaysUsageDescription' key in Info. plist and add location as a background mode in the 'Capabilities' tab in Xcode.


1 Answers

Use android manifest merging

Add new file android/app/src/release/AndroidManifest.xml

with contents

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    >
    <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
</manifest>

Done! More about manifest merging: https://developer.android.com/studio/build/manifest-merge.html#merge_priorities , section Merge priorities

like image 117
ColCh Avatar answered Sep 23 '22 14:09

ColCh