What kind of Android application will require android.permission.READ_PHONE_STATE permission?
Asked Answered
P

3

29

I have seen some Android apps on my phone require this android.permission.READ_PHONE_STATE permission. I don't know if I could trust them. I know this permission will give the app access to many information. I'm particularly interested in what functionality in an Android app normally require the information like DeviceId , SimSerialNumber, SubscriberId?

Putrescible answered 13/11, 2013 at 23:52 Comment(1)
See https://mcmap.net/q/502100/-android-read-phone-state for a sample usageRimbaud
C
23

Phone state provides access to a lot of information about the phone. Usual usages will be for reading the IMEI of your phone and your phone number. This can be useful to identify you in their systems.

It can also be needed if the application is made compatible for Android 1.5 or lower, because this permission didn't exist back then and is added automatically by the play store to those apps

See also: https://android.stackexchange.com/questions/605/why-do-so-many-applications-require-permission-to-read-the-phone-state-and-ident

Crusty answered 14/11, 2013 at 0:2 Comment(0)
P
21

Another possible reason is so they can mute audio events if you're in the middle of a call. This is why apps like Pandora, Spotify, etc need the permission - so they can mute themselves when you get a call.

Partheniaparthenocarpy answered 14/11, 2013 at 0:9 Comment(1)
Exactly. The problem is the Android permission is too coarse - an app only needs to know that a call is in progress in order to mute itself, not what number is connected, or the user's phone's IMEI. There is an Android issue to split this permission and there's a much better way of muting audio when a call comes, which doesn't require any permission - onAudioFocusChange.Elda
F
2

Not long ago I discovered that for some devices you should add android.permission.READ_PHONE_STATE if your application sends SMS. Probably in some cases SmsManager tries to retrieve some information about phone state before sending sms.

For example getting exception for HUAWEI GRA-L09:

java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10174 nor current process has android.permission.READ_PHONE_STATE.
at android.os.Parcel.readException(Parcel.java:1543)
at android.os.Parcel.readException(Parcel.java:1496)
at com.android.internal.telephony.ISms$Stub$Proxy.s! endMultipartTextForSubscriber(ISms.java:1224)
at android.telephony.SmsManager.sendMultipartTextMessage(SmsManager.java:404)
Faxon answered 19/6, 2017 at 20:14 Comment(3)
I'm having the same issue, any insights on what to do here? I think it's a problem to ask this major permission only for some cases where you need it for sending SMS.Thayne
@TomerPetel did you find any solution for this issue actually i am working on a my clg project in which i am developing a sms app i am facing this issue & my app is crashing on oreo, and antivirus is not allowing to open in kitkat & sending smsDereliction
@ArshKaushal no I didn't find a solution. I just put it in a try/catch clause and try an alternate method if SMS doesn't work (i.e. other sharing intents).Thayne

© 2022 - 2024 — McMap. All rights reserved.