In my Android
application I would like to make a phone call automatically when user click the button. I have used the below set of code to achieve this functionality
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:911"));
startActivity(intent);
and in my AndroidManifest.xml
I have added this <uses-permission android:name="android.permission.CALL_PHONE" />
permission too.
But it is just opening the dialer pad with the given 911
no instead of making a phone call.
Implicit Intent with URI data Uri number = Uri. parse("tel:11061991"); Intent callIntent = new Intent(Intent. ACTION_DIAL, number);
An intent allows you to start an activity in another app by describing a simple action you'd like to perform (such as "view a map" or "take a picture") in an Intent object.
At least in the US, 911 is an emergency number. CALL_PHONE
is insufficient to call that number. There is a separate permission for that (CALL_PRIVILEGED
?), one that cannot be held by ordinary SDK apps.
UPDATE: I remembered correctly. Here is the Android 6.0 platform manifest entry for that permission:
<!-- @SystemApi Allows an application to call any phone number, including emergency
numbers, without going through the Dialer user interface for the user
to confirm the call being placed.
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.CALL_PRIVILEGED"
android:protectionLevel="signature|privileged" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With