0

We wrote all permission codes between suitable tags. But when i install the program there is no ask about permissions. Where is my fault?

this my manifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.berker.notkayit">

<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="24" />


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



    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
androidTR
  • 9
  • 2
  • Possible duplicate of [Android marshmallow request permission?](http://stackoverflow.com/questions/33666071/android-marshmallow-request-permission) – David Rawson Dec 22 '16 at 09:24

4 Answers4

0

Writing permissions in Manifest file won't ask permissions on runtime. In order to show permissions, you need to write code in your application instances. Refer this link https://developer.android.com/training/permissions/requesting.html

Febi M Felix
  • 2,691
  • 1
  • 9
  • 13
0

are u testing the app in marshmallow or above device means it won't ask for permission during installation but it will permission during run time have u added the runtime permission codes

Ragu
  • 62
  • 8
0

It dependences on your devices, if you device Android version is below 6.0, then you way is ok, however, if you device version is 6.0 and above then you need add runtime permission, check this link https://github.com/googlesamples/easypermissions

juemuren4449
  • 105
  • 3
0

from marshmallow onwards we have to add programatically permissions at run time.

Read this documentation

https://developer.android.com/training/permissions/requesting.html

Breifly I am providing how its done

  1. Check if permission is given for not

int permissionCheck = ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.WRITE_CALENDAR);
  1. Then handle its

@
Override
public void onRequestPermissionsResult(int requestCode,
  String permissions[], int[] grantResults) {
  switch (requestCode) {
    case MY_PERMISSIONS_REQUEST_READ_CONTACTS:
      {
        // If request is cancelled, the result arrays are empty.
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

          // permission was granted, yay! Do the
          // contacts-related task you need to do.

        } else {

          // permission denied, boo! Disable the
          // functionality that depends on this permission.
        }
        return;
      }

      // other 'case' lines to check for other
      // permissions this app might request
  }
}

This is the way you have to handle in 6.0 and above, if your device is below 6.0, manifest will do it for you

Mrinmoy
  • 1,370
  • 2
  • 17
  • 27