【发布时间】:2022-01-14 11:40:37
【问题描述】:
为什么我运行这段代码时会出现这句话(to place a call enter a valid number)?
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + "#1234#"));
startActivity(intent);
但是,如果您将数字从 "#1234#" 更改为 "123456789",它可以正常工作 为什么不接受 (#) 符号?
知道我添加了
<uses-permission android:name="android.permission.CALL_PHONE" />
在 AndroidManifest.xml 中
注意:它仍然适用于低于 Android 11 的版本,并且可以毫无问题地接受 (#) 符号。
【问题讨论】:
-
我找到了解决方案 Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:"+ Uri.encode("#1234#")));开始活动(意图);
标签: android android-intent call phone-call android-phone-call