Permissions file AndroidManifest.xml [duplicate]

0

When you install app with Google Play, the app emits msg "App Stopped" so I have to go to Settings-> App-> APP and give the permissions manually.

Follow the permissions I need and are in the AndroidManifest.xml file

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.VIBRATE"/>

How do I solve this problem?

    
asked by anonymous 03.07.2017 / 17:09

1 answer

2

From the Android Marshmallow , API 23, users grant permissions to applications while they are running, not when they are installed.

  

This approach streamlines the application installation process as the   user does not need to grant permissions when installing or updating the   application.

In addition to this issue, it also gives the user more control over the features of the application. For example, a user could choose to allow a camera application to have access to the camera, but not to the location of the device. The user can revoke the permissions at any time in the application settings screen.

As shown at the time you grant the permission:

Checkoutthedocumentationon requesting runtime permissions

The following code checks whether the application has permission to read the user's contacts and requests the permission, if necessary:

if (ContextCompat.checkSelfPermission(thisActivity,
                Manifest.permission.READ_CONTACTS)
        != PackageManager.PERMISSION_GRANTED) {

    if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
            Manifest.permission.READ_CONTACTS)) {

    } else {


        ActivityCompat.requestPermissions(thisActivity,
                new String[]{Manifest.permission.READ_CONTACTS},
                MY_PERMISSIONS_REQUEST_READ_CONTACTS);
    }
}
    
03.07.2017 / 17:20