gpt4 book ai didi

android - Android 5 中的 Intent 操作调用

转载 作者:太空宇宙 更新时间:2023-11-03 12:07:04 24 4
gpt4 key购买 nike

我有这段代码,它在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com