Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does RECEIVE_SMS and READ_SMS permission do not have different prompt boxes to ask for permission?

I have listed both the permissions of RECEIVE_SMS and READ_SMS in my app's Manifest file and both of them has different permission strings too.

to grant the respective permissions. However, I have noticed that on granting(by the user) any one of the permissions(READ_SMS or RECEIVE_SMS) we can perform both the tasks. My question is that if both of them performs different tasks:

1) READ_SMS: It allows the app to read all the SMS's(currently present) on the user's phone.

2) RECEIVE_SMS: It allows the app to listen to all the SMS's that are received on the user's phone while he/she is using the app.

Both of them shows the same dialog box on asking for permission and on rejecting one of the permission both the dialog boxes do not appear.

If both have the same permission granting scenario's then why are they separated in form of two permissions? If anyone of you could help me with understanding this, then it would be a great help to me.

like image 991
Sudhanshu Vohra Avatar asked Oct 16 '25 18:10

Sudhanshu Vohra


1 Answers

According to Android documentation on Requesting Permissions:

Permission groups:
All dangerous Android system permissions belong to permission groups. If the device is running Android 6.0 (API level 23) and the app's targetSdkVersion is 23 or higher, the following system behavior applies when your app requests a dangerous permission:

If an app requests a dangerous permission listed in its manifest, and the app does not currently have any permissions in the permission group, the system shows a dialog box to the user describing the permission group that the app wants access to. The dialog box does not describe the specific permission within that group. For example, if an app requests the READ_CONTACTS permission, the system dialog box just says the app needs access to the device's contacts. If the user grants approval, the system gives the app just the permission it requested.

If an app requests a dangerous permission listed in its manifest, and the app already has another dangerous permission in the same permission group, the system immediately grants the permission without any interaction with the user. For example, if an app had previously requested and been granted the READ_CONTACTS permission, and it then requests WRITE_CONTACTS, the system immediately grants that permission.

Caution: Future versions of the Android SDK might move a particular permission from one group to another. Therefore, don't base your app's logic on the structure of these permission groups. For example, if your app requests the READ_CONTACTS permission, then the WRITE_CONTACTS permission, you shouldn't assume that the system can automatically grant the WRITE_CONTACTS permission, even though it's in the same permission group as READ_CONTACTS as of Android 8.0 (API level 26).

All SMS related permissions comes under permission group SMS.
Here is the list of permissions under SMS permission group:

  • SEND_SMS
  • SEND_SMS
  • RECEIVE_SMS
  • READ_SMS
  • RECEIVE_WAP_PUSH
  • RECEIVE_MMS
like image 56
lib4 Avatar answered Oct 18 '25 08:10

lib4



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!