java – Why doesn't the app ask for permission during installation?


The Android application does not ask for the permissions specified in the manifest during installation. I had a service for notifications there. And it doesn't work at all. In the manifest, everything is spelled out according to all the canons, but when I install it, it writes

no special permissions are required for this application.

even though there are a lot of uses-permission . How can you make it ask when installing?


Starting with API 23 (Android 6.0), " dangerous " permissions must be requested at runtime .

Check if you have the required permissions:

if (ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.WRITE_CALENDAR)
    != PackageManager.PERMISSION_GRANTED) {
    // Разрешение не получено

Requesting permission:

            new String[]{Manifest.permission.READ_CONTACTS},

We process the result of obtaining permits:

public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {

            // При отмене предоставления разрешений, этот массив пуст
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                // Разрешение получено

            } else {

                // Пользователь отказался предоставлять разрешение

        // Обрабатываем другие разрешения
Scroll to Top