shantanu
shantanu

Reputation: 2418

Intent.ACTION_CALL is ignoring '#' in android

I am trying to call from my application with the following format.

AcessNumber,CalleeNumber#

Trailing # reduce the dtmf trigger duration. But it's not working(making a call works but reducing delay doesn't work). If I call from native phone app with the same format it works every time. I triple checked my code and it's definitely adding trailing #.

final Intent callIntent = new Intent(Intent.ACTION_CALL);
StringBuilder buffer = new StringBuilder();
buffer.append("tel:");
buffer.append(accessNumber);
buffer.append(",");
buffer.append(number);
buffer.append("#");
callIntent.setData(Uri.parse(buffer.toString());
startActivity(callIntent);
Log.e("caller number", callIntent.getData().toString());

Upvotes: 0

Views: 142

Answers (2)

Gabriel Goudarzi
Gabriel Goudarzi

Reputation: 77

Really common problem among coders. The way you gonna have to solve this is by typing this code: String encodedhash = Uri.encode("#");

instead of buffer.append("#"); use buffer.append(encodedHash);

Cheers from Iran

Gabriel

Upvotes: 1

smali
smali

Reputation: 4805

The problem seems to me on on this line

callIntent.setData(Uri.parse(buffer.toString());

If you parse your buffer then it will remove the # character try instead like this

callIntent.setData((Uri.parse(buffer.toString())+"#");

Upvotes: 0

Related Questions