问题描述
我有这个code,工作正常的Android 4.4系统和previous:
I have this code, that works fine in Android 4.4 and previous:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number));
context.startActivity(intent);
现在,在安卓5.0棒棒堂本code不工作,并显示出此异常:
Now, in Android 5.0 Lollipop this code doesn't work, and shows this exception:
致命异常:android.content.ActivityNotFoundException无活动处理意向{行动= android.intent.action.CALL DAT =电话:XXXXXXXXX PKG = com.android.phone}
Fatal Exception: android.content.ActivityNotFoundExceptionNo Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxx pkg=com.android.phone }
在这个文件的意图不会出现pcated德$ P $: HTTP ://developer.android.com/reference/android/content/Intent.html
In the documentation this intent doesn't appear deprecated: http://developer.android.com/reference/android/content/Intent.html
你知道吗?在此先感谢
推荐答案
好像包的名称已改为com.android.phone到com.android.server.telecom。
Seems like the package name has been changed from "com.android.phone" to "com.android.server.telecom".
希望这有助于!
这篇关于意向行动电话在Android中5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!