我想发送代码*777#到拨号器在安卓使用意图,但我有一个问题*777关键代码将显示在拨号器上,而不是#如何解决这个问题我是新的安卓开发人员,所以请帮助我解决这个问题。
String dialler_Code = "*777#";
Toast.makeText(this, "clicked", Toast.LENGTH_LONG)
.show();
// Use format with "tel:" and phoneNumber created is stored in u.
Uri u = Uri.parse("tel:" + dialler_Code);
// Create the intent and set the data for the intent as the phone number.
Intent i = new Intent(Intent.ACTION_DIAL, u);
try {
// Launch the Phone app's dialer with a phone number to dial a call.
startActivity(i);
} catch (SecurityException s) {
// show() method display the toast with exception message.
Toast.makeText(this, s.getMessage() , Toast.LENGTH_LONG)
.show();
}
发布于 2019-03-06 20:55:07
尝试使用String dialler_Code = Uri.encode("*777#");
发布于 2019-03-06 20:57:47
**使用:**
String enCodedHash = Uri.encode("#");
String number = "*151*1" + enCodedHash;
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+ number));
startActivity(callIntent);
https://stackoverflow.com/questions/55023559
复制相似问题