Reputation: 29
I trying to build an app with react-native .. and i need to get imei from androidphone.. I added
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
on manifest.. But it still did not work, and the error appears on inspect element is...
Possible Unhandled Promise Rejection (id: 1): Error: Missing permission android.permission.READ_PHONE_STATE Error: Missing permission android.permission.READ_PHONE_STATE
i use RN version 0.61.2
Upvotes: 1
Views: 5440
Reputation: 2513
The problem is that you had declared the permission and but user has not granted that permission
All permission in android are not same, some needs to be get access from user
You need to ask the user before accessing phone state and if the user deny it then you need to handle it
some reference may help you
Possible Unhandled Promise Rejection (id:0) Warning
Upvotes: 0
Reputation: 347
adding the permissions in the manifest file does necessarily give them to the app. Some permissions are considered dangerous and the user can disable them anytime starting from android marshmallow. So they have to be checked explicitly programmatically before using them. Read react native documentation for how to do that. https://facebook.github.io/react-native/docs/permissionsandroid
Upvotes: 2