1

I am doing an application which utilize the incoming call screen of Android with the follow code:

Intent inCallIntent = new Intent();
inCallIntent.setClassName("com.android.phone", "com.android.phone.InCallScreen");
startActivity(inCallIntent);

But I received the follow error:

10-03 17:23:30.802: ERROR/AndroidRuntime(1495): java.lang.RuntimeException: Error receiving broadcast Intent { act=...alarmservice flg=0x4 (has extras) } in ...CallMeSoon$2@44635330
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:771)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.os.Handler.handleCallback(Handler.java:609)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.os.Looper.loop(Looper.java:123)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.ActivityThread.main(ActivityThread.java:4595)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at java.lang.reflect.Method.invokeNative(Native Method)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at java.lang.reflect.Method.invoke(Method.java:521)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at dalvik.system.NativeStart.main(Native Method)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.phone/.InCallScreen } from ProcessRecord{449ae8e0 1495:....callmesoon/10099} (pid=1495, uid=10099) requires null
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.os.Parcel.readException(Parcel.java:1218)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.os.Parcel.readException(Parcel.java:1206)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1226)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.Activity.startActivityForResult(Activity.java:2789)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.Activity.startActivity(Activity.java:2895)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at ....CallMeSoon$2.onReceive(CallMeSoon.java:304)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:760)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495):     ... 9 more

I know that the permission from somewhere is missed. But what could be?

Updated: The permission is neither android.permission.CALL_PHONE nor android.permission.CALL_PRIVILEGED

jiahao
  • 3,373
  • 2
  • 35
  • 36

2 Answers2

1

Caused by: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.phone/.InCallScreen } from ProcessRecord{449ae8e0 1495:....callmesoon/10099} (pid=1495, uid=10099) requires null

this is the root cause, and it arises due to double entry of application component in the application Manifestfile. you might have declared InCallScreen activity more than one time in your manifest file. Just double check it.!!

Aakash
  • 386
  • 2
  • 15
0

Add this to AndroidManifest.xml

android.permission.CALL_PHONE

or

android.permission.CALL_PRIVILEGED

Also aren't you missing the phone number to dial usually you set this in the intents data. You need to setup your Intent like this if you want to make a call or use these other Intent actions

Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:+15554441212"));
startActivity(intent);
JPM
  • 9,077
  • 13
  • 78
  • 137
  • Thanks for your answer, but the permission required is not anyone you mentioned. I still have the same permission problem. – jiahao Oct 04 '11 at 13:43