我已经在menifest文件上给了ACTION_CALL权限,但在Android9派中它不是working..IT,在Android10中也可以工作
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:100"));
startActivity(intent);发布于 2019-11-21 18:59:21
首先,确保您在清单<uses-permission android:name="android.permission.CALL_PHONE"/>中设置了权限,然后尝试以下代码
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + xxxxxxxx));
startActivity(intent);如果您想在没有任何权限的情况下执行此操作,只需使用ACTION_DIAL而不是ACTION_CALL来预先填充拨号器并让用户拨打电话
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:xxxxxxx"));
startActivity(intent);发布于 2019-11-22 12:43:49
在清单文件中添加权限
<uses-permission android:name="android.permission.CALL_PHONE" />添加意图
int number = 123 123 123
Intent i = new Intent(Intent.ACTION_DIAL);
startActivity(i.setData(Uri.parse("tel:" + number));)https://stackoverflow.com/questions/58972854
复制相似问题