Question

I have a class that makes a call to an emergency number. I get to the "call" app with the phone number already passed in, but i still have to press the Call Button to start the call.

Is there a possibility where i don't actively have to press the call button but it does it automatically?

Was it helpful?

Solution

Emergency numbers always require that the user presses a button explicitly. This is a security feature.

See docu for ACTION_CALL

OTHER TIPS

As henry has mentioned in his answer, its only possible call emmergency number using ACTION_DIAL. Howerver you can call anyother number directly using this intent.

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "ur phoneNumber here"));
startActivity(intent);

Dont Forget to Add this Permission to the Manifest :

 <uses-permission android:name="android.permission.CALL_PHONE" />
Intent intent = new Intent(Intent.ACTION_CALL);

intent.setData(Uri.parse("tel:" + bundle.getString("mobilePhone")));
context.startActivity(intent);

Permission required is

<uses-permission android:name="android.permission.CALL_PHONE" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top