I am trying to make call from my app. But every time it get crashed with no error shown on logcat. I took permission in manifest also check it at runtime.
public void call(String number){
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+number));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(callIntent);
}
Are you sure context is not null ? You should do something like this. Inside your calling activity make these changes
private void requestCallPermission() { final String[] permissions = new String[]{Manifest.permission.CALL_PHONE}; ActivityCompat.requestPermissions(this, permissions, REQUEST_CALL_PHONE_PERMISSION); }
And finally add this this permission to Android Manifest.xml