Well, it's about allowing runtime, so only declaring them in the manifest will not work. Instead, you should check the right before starting the call.
Something like this should work - the user will only be asked permission if he has not provided it earlier (or if he revoked it):
private static final int MY_PERMISSIONS_REQUEST_CALL_PHONE = 1234; public void yourfunction() { number_title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.CALL_PHONE}, MY_PERMISSIONS_REQUEST_CALL_PHONE); } else { executeCall(); } } }); } private void executeCall() {
I took the above code mainly from google: http://developer.android.com/training/permissions/requesting.html Follow the link if you want more information.
Edit: onRequestPermissionsResult will be a callback function in your activity. You may need to handle the call.
source share