I am making an application in with user scan card number (14-digit) number thru camera then make a call. The call require a wildcard character "#" at the end of the number, but my app don`t add that character. What should I do?
I am using this
String cardNumber = textValue.getText().toString().trim();
int permissionCheck = ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CALL_PHONE);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.CALL_PHONE}, Integer.parseInt("123"));
}
else {
startActivity(new Intent(Intent.ACTION_DIAL).setData(Uri.parse("tel:*123*"+cardNumber+"#")));
}
You can use this code for your issue :
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:"+ Uri.encode("*123#")));
startActivity(callIntent);
or
add value at runtime
Intent callIntent = new Intent(Intent.ACTION_DIAL);
String cardnm = "8585"; // cardname value......
callIntent.setData(Uri.parse("tel:" + Uri.encode("*123*" + cardnm + "#")));
startActivity(callIntent);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.