What is the difference between asking for permission using <uses-permission>, and android:permission inside the application and activity tags?
When I only use:
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
The app runs fine, however if also I use:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"
android:permission="android.permission.WAKE_LOCK">
or even:
<activity android:name=".android.Everlong"
android:label="@string/app_name" android:screenOrientation="portrait"
android:permission="android.permission.WAKE_LOCK">
The app doesn’t start because of a security error…
From the documentation:
uses-permission — At install time (of your App) the user must accept this permission.
android:permission — When another App wants to call your App, you can specify which permission they need to request (at install of the other App) to call you.
Basically, if another application wants to call YOUR
Activityvia anIntent, and you specify that you require a permission in this way, that App must have access to that permission. Otherwise, theIntentwill be rejected by your App.