Skip to content Skip to sidebar Skip to footer

Solve The Error:: Revoked Permission Android.permission.call_phone

How to solve this error: revoked permission android.permission.CALL_PHONE This is my Java code: public class DetailContactActivity extends AppCompatActivity implements OnClickLi

Solution 1:

Switch to DIAL_PHONE, as that does not need a permission.

Just replace this line

Intent callIntent = new Intent(Intent.ACTION_CALL);

to

Intent callIntent = new Intent(Intent.ACTION_DIAL);

Solution 2:

Android 6 (SDK 23) allows users to revoke permissions from an app. I guess, thats what happened here. Your app must be able to cope with this situation.

Have a look at the documentation for the details.

In particular:

If the device is running Android 6.0 or higher, and your app's target SDK is 23 or higher: The app has to list the permissions in the manifest, and it must request each dangerous permission it needs while the app is running. The user can grant or deny each permission, and the app can continue to run with limited capabilities even if the user denies a permission request.

Requsting permissions at runtime is described in detail here.

Solution 3:

Add this permission in the manifest file:

<uses-permissionandroid:name="android.permission.CALL_PHONE"/>

or else try this too.

<uses-permissionandroid:name="android.permission.CALL_PRIVILEGED"/>

CALL_PRIVILEGED Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed. Not for use by third-party applications.

Solution 4:

i'm late. You must request permission dynamically.

// Here, thisActivity is the current activityif (ContextCompat.checkSelfPermission(thisActivity,
                Manifest.permission.READ_CONTACTS)
        != PackageManager.PERMISSION_GRANTED) {

    // Should we show an explanation?if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
            Manifest.permission.READ_CONTACTS)) {

        // Show an expanation to the user *asynchronously* -- don't block// this thread waiting for the user's response! After the user// sees the explanation, try again to request the permission.

    } else {

        // No explanation needed, we can request the permission.ActivityCompat.requestPermissions(thisActivity,
                newString[]{Manifest.permission.READ_CONTACTS},
                MY_PERMISSIONS_REQUEST_READ_CONTACTS);

        // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an// app-defined int constant. The callback method gets the// result of the request.
    }
}

more details at https://developer.android.com/training/permissions/requesting.html

Solution 5:

Please change call_phone to dial phone. As you need to dial the number.

Intent callIntent=newIntent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:1234567890"));
startActivity(callIntent);

Post a Comment for "Solve The Error:: Revoked Permission Android.permission.call_phone"