How to send DTMF signals and pauses using Android ACTION_CALL Intent with commas in number?

I have an application that calls a number stored by a user. Everything works fine, unless the number contains commas or hash characters, in which case Uri is truncated after the digits. I read that you need to code a hash sign, but even doing this, or without a hash sign, commas will never pass. However, they go through if you just pick a number from your contacts. I have to do something wrong. For instance:

String number = "1234,,,,4#1";
Uri uri = Uri.parse(String.format("tel:%s", number));
try {
  startActivity(new Intent(callType, uri));
} catch (ActivityNotFoundException e) { ...

Only number "1234" will get into the dialer.

+3
source share
2 answers

- URL-. , ( %2C, hash is %23) , .

0

',', '*' '#':

Intent intentCallForward = new Intent(Intent.ACTION_CALL);                             
Uri uri = Uri.fromParts("tel", phoneNumber, "#"); 
intentCallForward.setData(uri);                                
startActivity(intentCallForward); 
0

Source: https://habr.com/ru/post/1739061/


All Articles