KIO
Kreative Ideen online
Android permission

Android permission

You declare the permissions your app requires in the AndroidManifest.xml using the ..

<uses-permission>

element.

To allow access to the user’s precise location you would declare the …

ACCESS_FINE_LOCATION

permission.

AndroidManifest.xml example:

<?xml version="1.0" encoding="utf-8" ?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.somename.project">
 
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
       .....
    </application>

  </manifest>

How the app uses the above declaration depends on the targetSDK and the API level of the user’s device:

  • If target SDK is API lvl 23 or above and the user’s device is running 23 or above
    The app requests permission at runtime. The user can deny or revoke permission, so whenever code wants to use the thing required, it needs to check that permission is still granted.
  • If your target SDK is API level 22 or below, or the user’s device is running 22 or below
    The app requests permission when it’s installed. If the user permission, the app isn’t installed. Once granted, permission can’t be revoked except by uninstalling the app.

Leave a Reply

Your email address will not be published. Required fields are marked *