I recently added firebase messaging to my android app and I noticed some new permissions required to my app at similar time, for example:
android.permission.READ_PHONE_STATE
I couldn't find anywhere in documentation, why is this permission required. I even tried to explicitly disable it in manifest (tools:node="remove"
) and messaging still works for me. It's kinda messy and I want to use only as few permissions as I need for sake of my users.
Is this permissions really needed by messaging or is it added automatically from one of library dependencies?
How can I tell what permissions is being added by what? I tried manifest-merger-report.txt
, but there was no mention about READ_PHONE_STATE
.
Thanks!
The
READ_PHONE_STATE
permission is not needed for Firebase Cloud Messaging to work (see the Edit your App Manifest docs).From what I can tell, you've already done quite the digging with this tiopic (checking the
manifest-merger-report.txt
, addingtools:node="remove"
to disable it). You've probably seen Commonsware's blog too.It's hard to tell from where the
READ_PHONE_STATE
permission is coming from (with the current details your post), but it is most probably the cause of manifest merging. Try double checking if there are any dependencies that have the library's min SDK is lower than the app's min SDK, wherein if true, the permission is added, as per this answer:I had the same problem, i checked manifest-merger-report, and found that READ_PHONE_STATE was added because some library that I'm using has target version < 4
Here is exact quote from report:
Hope, this will help you. Question is possibly duplicate of: Firebase + Permissions
Firebase did not add this permission. Update your Google Play services to 10.0.1 as this bug seems to have been fixed in that version:
Ok this is embarrassing. I in the end, I was adding permissions myself in parent manifest. Thank you for your comments, based on those I managed to track it down.