I have implemented Dexter in my app. It is work fine for CAMERA,EXTERNAL STORAGE and INTERNAL STORAGE permission. I want to call with PHONE_CALL permission with Dexter. When i call intent for phone call like this:
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + strNum));
startActivity(callIntent);
then startActivity
shows warning Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException less... (Ctrl+F1)
I don't understand that i have implement Dexter then why startActivity
want self permission?
For API 23+ you should check for permission as:
if (mContext.checkSelfPermission(Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED) {
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + strNum));
startActivity(callIntent):
}
Intent.ACTION_CALL intent
, which requires a permission, namely the android.permission.CALL_PHONE one. But for sdk>=23 you need to check in runtime with Manifest.permission.CALL_PHONE
. It is for targetedsdkversion 23 and above.
If you lower your targetedsdkversion below 23 then you don't need this persmission and Intent.ACTION_CALL
will work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With