如果号码包含 #,则使网络呼叫不起作用



嗨,我正在创建一个安卓应用程序来使用以下代码呼叫网络号码:

public void onClick(View v) {
    String num= "*123#";
    String number = "tel:" + num;
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number)); 
    startActivity(callIntent);
} 

但"#"没有出现在被叫号码中

我认为这是安全问题?

试试这个:

      public void onClick(View v) {
    String num= "*123";
String encodedHash = Uri.encode("#");
string last = num + encodedHash;
    String number = "tel:" + last;
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number)); 
    startActivity(callIntent);
}

最新更新