我有这段代码,在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棒棒糖版本中,这段代码不起作用,并显示出以下异常:
Fatal Exception: android.content.ActivityNotFoundException
No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxx pkg=com.android.phone }
在文档中,这个
Intent
看起来没有被废弃:你有什么想法吗?谢谢。