How to request a Permission? I tried to documentation, but the constant int request code MY_PERMISSIONS_REQUEST_CALL_PHONE donst seem to just work, anything else to bear in mind for Backwards compatibility?
ActivityCompat.requestPermissions(getApplicationContext(),
new String[]{Manifest.permission.READ_CONTACTS},
MY_PERMISSIONS_REQUEST_CALL_PHONE);
How to declare MY_PERMISSIONS_REQUEST_CALL_PHONE constant int?
Try below code hope it will help you. First this will ask you for permission popup after allowing it will call the number.
For lower versions you need to declare permission in manifest only, but for marshmellow you need to give it in the code, where you want to execute the code.
Here, you want to make a call. So, insert/include the code provided below in the code block written to make the call.
Try doing this.
//Now call the method makeCall("your_desire_phone_numder"); makeCall("100"); Link for more details