Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between Uses-Permission and Permissions tag in AndroidManifest.xml

Tags:

android

What is the difference between Uses-Permission and Permissions tag in AndroidManifest.xml . I understood uses-permission tag as it is used to access Internet,Location from our application. But I did not understand when and why should we use permissions tag in Manifest file and what is its difference from uses-permission.

like image 590
Android_programmer_camera Avatar asked Oct 03 '10 17:10

Android_programmer_camera


People also ask

What is the difference between permission and uses permission?

What is difference between permission and uses-permission in Android? 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. uses-permission is used when your app actually needs a permission it doesn't have normally.

What is permission tag in manifest file?

contained in: <manifest> description: Declares a security permission that can be used to limit access to specific components or features of this or other applications. See the Permissions section in the introduction, and the Security and Permissions document for more information on how permissions work.

What is permission use?

Specifies a system permission that the user must grant in order for the app to operate correctly. Permissions are granted by the user when the application is installed (on devices running Android 5.1 and lower) or while the app is running (on devices running Android 6.0 and higher).


1 Answers

Quoting the documentation:

To enforce your own permissions, you must first declare them in your AndroidManifest.xml using one or more <permission> tags. For example, an application that wants to control who can start one of its activities could declare a permission for this operation as follows:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.me.app.myapp" >      <permission android:name="com.me.app.myapp.permission.DEADLY_ACTIVITY"         android:label="@string/permlab_deadlyActivity"         android:description="@string/permdesc_deadlyActivity"         android:permissionGroup="android.permission-group.COST_MONEY"         android:protectionLevel="dangerous" />  </manifest> 

Hence, <uses-permission> is when your application is seeking the user's permission to use some feature, while <permission> is when your application is requiring other apps to seek the user's permission to use some feature of yours.

like image 139
CommonsWare Avatar answered Sep 30 '22 15:09

CommonsWare