uses-permission vs permission for android permissions in the manifest.xml file

Kevik picture Kevik · Jan 22, 2013 · Viewed 34.8k times · Source

I noticed that there are two types of permissions in the manifest file, "permission" and "uses-permission" like the two shown below;

 <permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

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

for the following 4 permissions which do I use when I put them in my manifest.xml file? uses-permissions or permissions?

android.permission.ACCESS_NETWORK_STATE

android.permission.ACCESS_WIFI_STATE

android.permission.INTERNET

android.permission.CHANGE_WIFI_MULTICAST_STATE

Answer

A--C picture A--C · Jan 22, 2013

For

<permission>

The documentation states:

Declares a security permission that can be used to limit access to specific components or features of this or other applications.

Therefore, since you are accessing Android's permissions, you want uses-permission instead. The documentation for this element states:

Requests a permission that the application must be granted in order for it to operate correctly.

<permission> is normally used when making a custom permission (e.g. when making an app that other apps can tie in to, limiting access is a must), and <uses-permission> is used when your app actually needs a permission it doesn't have normally.