我做這利用了Android的呼入電話屏幕與後續的代碼的應用程序:啓動InCallScreen活動
Intent inCallIntent = new Intent();
inCallIntent.setClassName("com.android.phone", "com.android.phone.InCallScreen");
startActivity(inCallIntent);
但我收到了如下錯誤:
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): java.lang.RuntimeException: Error receiving broadcast Intent { act=...alarmservice flg=0x4 (has extras) } in [email protected]
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
我知道,來自某處的許可被錯過了。但是,可能是什麼?
更新:權限是既不 android.permission.CALL_PHONE 也不 android.permission.CALL_PRIVILEGED
感謝您的回答,但所需的權限不是您提到的任何人。我仍然有同樣的權限問題。 – jiahao