For something like “help, I can’t get up” the application - is there a way for the user to set a contact number, and then for the application to call this number in the future WITHOUT the user initiating the dialout? I tried below, but there seems to be a problem:
private void callPhone(){
if(phoneNumber.length()>0){
try {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:"+phoneNumber));
startActivity(intent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Problem calling number.", Toast.LENGTH_LONG).show();
}
}
}
source
share