android - Android 5 中的 Intent 操作调用

标签 android android-intent android-5.0-lollipop

我有这段代码,它在 Android 4.4 及之前的版本中运行良好:

Intent intent = new Intent(Intent.ACTION_CALL);         
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number));
context.startActivity(intent);

现在,在 Android 5.0 Lollipop 中这段代码不起作用,并显示此异常:

Fatal Exception: android.content.ActivityNotFoundException
No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxx pkg=com.android.phone }

In the documentation , 这个 Intent 并没有被弃用:

有什么想法吗?提前致谢

最佳答案

似乎包名已经从

com.android.phone 

com.android.server.telecom.

希望这对您有所帮助!

关于android - Android 5 中的 Intent 操作调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27102000/

相关文章:

java - 从 ViewPager fragment 刷新 Activity

android - 在 Snapdragon Flight DSP 上打开的文件返回可疑的大量数字

android - 错误 R.id.togglebutton1 等

android - 如何从android中的edittext中获取选定的文本?

android - 与 Dialog Activity 共享元素转换

android - 使用 Xposed 在另一个应用程序中 Hook 私有(private)方法

android - textview 不支持多行

带选择按钮的 Android 目录/文件夹选择器

android - 如何设置 documentLaunchMode "sticks together"(就像 Chrome 所做的那样)?

android - 如何在旧设备上使用 Theme.Material 启动应用程序