Reputation: 331
I have use this intent to dial a no which is written in the setdatafield of the Intent But when I run app and click on the button of call where i put this intent i got this error in LogCat
06-14 14:08:10.137: ERROR/AndroidRuntime(2898): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:2125551212 cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{43edbe18 2898:com.collabera.labs.sai/10102} (pid=2898, uid=10102) requires android.permission.CALL_PHONE
Upvotes: 12
Views: 23680
Reputation: 8992
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:03000000000"));
startActivity(intent);
Add Permission
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
Upvotes: 10
Reputation: 10262
The Intent.ACTION_DIAL intent (instead of Intent.ACTION_CALL) doesn't need a permission. It only brings up the dialer so the user can decide himself whether or not to call, which is a better user experience in most cases anyway.
Upvotes: 29
Reputation: 21
Also you can try
<uses-permission android:name="android.intent.action.CALL_PRIVILEGED"></uses-permission>
it's deprecated constant but it helps to start a call instantly without dialer activity opening
Upvotes: 2
Reputation: 21909
There is a clue in the error: requires android.permission.CALL_PHONE
You need to declare the android.permission.CALL_PHONE
permission in your manifest:
<manifest android:installLocation="preferExternal" package="yourpackage"
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1" android:versionName="1">
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
.
.
.
</manifest>
See here for more information.
Upvotes: 6