Permissions Androidmanifest.xml file

Asked

Viewed 6,203 times

0

When performing the installation of the app by Google Play, the app send the msg "App Stopped" so I have to go in settings->Apps->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 to solve this problem?

1 answer

3

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

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

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 app access to the camera, but not the location of the device. The user can revoke permissions at any time on the application settings screen.

As shown at the time you grant permission:

inserir a descrição da imagem aqui

Check here in the documentation about request for runtime permissions

The following code checks if the application has the permission to read the user’s contacts and asks for 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);
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.