What are the different protection levels in Android Permission?

What are the different protection levels in Android Permission?

Whenever we are developing an Android application, we need various components of Android devices like camera, GPS, etc. So, to use these features of our Android device, we need to take permission from the user to use something present on their phone. You can’t directly use any of those features. Also, there are various protection levels in permission i.e. if the protection level of permission is very low then you need not ask the user to use that permission. You can directly use that. But for dangerous permissions, you need to explicitly take permission from the user.

In this blog, we will learn various protections levels in permission. So, let’s get started.

Protection levels

Normally, if we want to add take some permission from the user, we write the below code in our AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

The above line grants permission to use the internet.

Using permission is not a simple task, you have to decide if you need to explicitly ask the user for permission or you can directly take permission. This decision is made based on the protection level of permission. Following are the three protection levels of permissions in Android:

  1. Normal Permissions
  2. Signature Permissions
  3. Dangerous Permissions

These are the three main protection levels of permissions, apart from this there is one more protection level called the Special Permission. Let’s have a look at them, one by one.

Normal Permissions

If there is a very little or no risk of the user privacy then the permission comes under the Normal Permission category. For example, if you want to get the data and time, then these things involve no user privacy and in this case, you need not ask the user to use date or time. You can directly use this facility by adding permission in the AndroidManifest.xml file. At the installation time, the system will automatically grant permission to your app. Following are the permission that comes under Normal Permissions:

  1. ACCESS_LOCATION_EXTRA_COMMANDS
  2. ACCESS_NETWORK_STATE
  3. CHANGE_NETWORK_STATE
  4. ACCESS_WIFI_STATE
  5. CHANGE_WIFI_STATE
  6. CHANGE_WIFI_MULTICAST_STATE
  7. BLUETOOTH
  8. BLUETOOTH_ADMIN
  9. INTERNET
  10. SET_ALARM
  11. SET_WALLPAPER
  12. VIBRATE
  13. WAKE_LOCK

Signature Permissions

The android system grants these permissions at the installation time but there is one condition. The app that is asking for some permission must be signed with the same signature as that of the app that defines the required permission. Following are some of the Signature permissions:

  1. BIND_ACCESSIBILITY_SERVICE
  2. BIND_AUTOFILL_SERVICE
  3. BIND_CARRIER_SERVICE
  4. BIND_DEVICE_ADMIN
  5. BIND_INPUT_METHOD
  6. BIND_NFC_SERVICE
  7. BIND_TV_INPUT
  8. BIND_WALLPAPER
  9. READ_VOICEMAIL
  10. WRITE_SETTINGS
  11. WRITE_VOICEMAIL

Dangerous Permissions

Dangerous permissions include that permission that involve user data in some or the other way. For example, if you want to read contacts from the phone or you want to access the file storage of the phone then these permissions come under the Dangerous permission as they include user’s privacy. To use Dangerous permissions, you have to explicitly ask for permission before using that by showing some alert dialog or any other dialog. If the user denies the permission then your application can’t use that particular permission. Following are some of the Dangerous permissions:

  1. READ_CALENDAR
  2. WRITE_CALENDAR
  3. CAMERA
  4. READ_CALL_LOG
  5. WRITE_CALL_LOG
  6. READ_CONTACTS
  7. WRITE_CONTACTS
  8. GET_ACCOUNTS
  9. ACCESS_FINE_LOCATION
  10. ACCESS_COARSE_LOCATION
  11. SEND_SMS
  12. RECEIVE_SMS

Special Permissions

These are those permissions that are neither Normal permissions nor Dangerous permissions. Most of the applications should not use these permissions because they are very sensitive and you need user authorization before using these permissions. To use this permission, you must declare it in the AndroidManifest.xml file and then send an intent to request for user authorization. Some of the Special permissions are:

  1. WRITE_SETTINGS
  2. SYSTEM_ALERT_WINDOW

Conclusion

In this blog, we learned various protection levels that are present in permissions. They are Normal permissions, Signature permissions, and Dangerous permissions. If you want to look more examples of these permissions then you can refer to the Android website .

Keep Learning :)

Team MindOrks!