Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call 911 in Android

I want to call Emergency number using Android SDK.

I am using following code to call the number (911). This code works fine for all the numbers except 911 (Emergency Number). When I use 911, then it shows the dialer screen that I don't want. Is there any procedure to call 911 without open the dialer or can we stop the user to edit the number in Dialer screen?

Uri callUri = Uri.parse("tel://911");
Intent callIntent = new Intent(Intent.ACTION_DIAL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);
like image 853
Amit Thaper Avatar asked Mar 14 '11 11:03

Amit Thaper


People also ask

Does Android have an emergency call feature?

Android 10 also supports emergency calling based on the type of emergency services such as police, fire, or ambulance.

Can I dial 911 from my cell phone?

All wireless phones, even those that are not subscribed to or supported by a specific carrier, can call 911.


2 Answers

The code provided should already work for this, but you need the CALL_PHONE and CALL_PRIVILEGED permission to dial emergency numbers without showing the dial-pad.

Android Reference - Manifest Permission CALL_PRIVILEGED

Once that is added to the manifest, you should be able to use the same code using the ACTION_CALL instead to direct dial:

Uri callUri = Uri.parse("tel://911");
Intent callIntent = new Intent(Intent.ACTION_CALL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);
like image 53
SandWyrm Avatar answered Oct 13 '22 13:10

SandWyrm


Action_Dial will open the dialpad, Action_Call will call directly..

However, a quote from ACTION_CALL:

Note: this Intent cannot be used to call emergency numbers. Applications can dial emergency numbers using ACTION_DIAL, however.

like image 30
Maaalte Avatar answered Oct 13 '22 13:10

Maaalte