Open In App

What are The Different Protection Levels in Android Permission?

Last Updated : 19 Sep, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

When building an Android application, we require different Android device components such as the camera, GPS, and so on. So, in order to use these capabilities of our Android smartphone, we must first obtain permission from the user to use something on their phone. You cannot utilize any of those functionalities directly. Furthermore, permission has different protection levels; for example, if the permission’s protection level is very low, you do not need to ask the user to use that permission. You may use it right away. However, for hazardous permissions, you must expressly obtain the user’s permission. In this geeks for geeks article, we will learn about the various layers of authorization protection.

Levels of Protection

Normally, if we want to add certain user permissions, we enter the following code in our AndroidManifest.xml file:

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

The preceding line enables access to the vibration or the haptic motor of the device.

Using permission is not an easy process; you must decide if you need to explicitly ask the user for permission or whether you may take permission immediately. This choice is dependent on the permission’s degree of protection. The three permission protection levels in Android are as follows:

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

These are the three primary permissions protection levels; however, there is an additional security level known as the Special Permission. Let’s take a look at them one at a time.

Permission Category #1: Normal Permissions

The permission falls within the Normal Permission category if there is little or no danger to the user’s privacy. For example, if you want to acquire the data and time, these things do not entail any user privacy, and you do not need to ask the user to use date or time in this situation. You may utilize this feature directly by adding permission to the AndroidManifest.xml file. The system will automatically provide authorization to your app during the installation process. Normal Permissions include the following 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

Permission Category #2: Signature Authorization

The Android system gives these rights during installation, but there is a catch. The app requesting permission must be signed with the same signature as the app defining the needed permission.  Some of the Signature permissions are as follows:

  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

Permission Category #3: The dangerous ones

Permissions that are dangerous include those that affect user data in some way. For example, if you wish to read contacts from the phone or access the phone’s file storage, these rights fall under the Dangerous category since they involve the user’s privacy. To utilize Dangerous permissions, you must first expressly seek permission by displaying an alert dialogue or any other dialogue. If the user refuses the permission, your application will be unable to utilize that permission. Some of the Dangerous permissions are as follows:

  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

Permissions Exceptions

These are the permits that are neither Normal nor Dangerous in nature. Most apps should not utilize these rights since they are extremely sensitive and require user consent before being used. To utilize this permission, declare it in the AndroidManifest.xml file and then submit an intent requesting user authorization. Some of the special permissions are as follows:

  1. WRITE_SETTINGS
  2. SYSTEM_ALERT_WINDOW

Conclusion

In this article, we learned about the various degrees of protection available in permissions. Normal permissions, Signature permissions, and Dangerous permissions are the three types.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads