How do I send DTMF tones and pauses using Android ACTION_CALL Intent with commas in the number?

I have an application that calls a number stored by the user. Everything works okay unless the number contains commas or hash signs, in which case the Uri gets truncated after the digits. I have read that you need to encode the hash sign but even doing that, or without a hash sign, the commas never get passed through. However, they do get passed through if you just pick the number from your contacts. I must be doing something wrong. For example:

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

Only the number '1234' would end up in the dialer.


Hashes and commas are reserved characters in URLs. Hence, convert both of those (comma is %2C, hash is %23) and see if that helps.

Works for me with ',' , '*' & '#':

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

Need Your Help

Which one to choose as Project build target ? Google APIs or SDK platform

android google-maps android-build android-version

I have been searching but couldn't find the difference between both of these things. I have read other questions in which people have said that we should use Google Apis as build target when we wan...