Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Permissions in Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 275
    Comment on it

    Android use Permissions

    In android we have to set permissions in the project manifest file to get the required android resource. In a basic android application there are no permissions associated with it by default,so it cannot affect the other user experience or any other data.

    For example, an application that needs to monitor incoming SMS messages would specify:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.app.myapp" >
        <uses-permission android:name="android.permission.RECEIVE&#95;SMS" />
        ...
    </manifest>
    

    Syntax for uses-permission :

    <uses-permission android:name="string"
            android:maxSdkVersion="integer" />
    

    Attributes:

    android:name - to specify the name of the permission used

    android:maxSdkVersion-to give the highest API level at which this permission should be granted to your app

    Examples of android uses-perrmission

        <uses-permission android:name="android.permission.ACCESS&#95;NETWORK&#95;STATE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.READ&#95;PHONE&#95;STATE" />
        <uses-permission android:name="android.permission.WRITE&#95;EXTERNAL&#95;STORAGE" />
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.FLASHLIGHT" />
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ&#95;GSERVICES" />
        <uses-permission android:name="android.permission.ACCESS&#95;COARSE&#95;LOCATION" />
        <uses-permission android:name="android.permission.ACCESS&#95;FINE&#95;LOCATION" />
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: