Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intent.ACTION does not dial after first # sign

Tags:

android

I am trying to make a call with a long number that looks something like this.

tel:883994555,,,32343#,,,#

with code that looks like this.

        Intent intent = new Intent(Intent.ACTION_CALL);
        Uri uri = Uri.parse(number);
        intent.setData(uri);
        startActivity(intent);

What I see is that, the phone does not dial after the first '#' sigh. Any one knows how to make this to work.

Thanks.

like image 897
prakash Avatar asked May 24 '11 19:05

prakash


2 Answers

How I got this to work was to use ';' (semicolon) for the hard wait instead of the 'w', and ',' (comma) for the pause, and then encode the phone number first, like this -

Uri.parse(String.format("tel:%s", Uri.encode(number)))
like image 99
ScottTx Avatar answered Sep 19 '22 12:09

ScottTx


Uri.parse(String) parses an RFC 2396-compliant, encoded URI.

RFC 2396 says:

The character "#" is excluded because it is used to delimit a URI from a fragment identifier in URI references.

like image 29
pawelzieba Avatar answered Sep 20 '22 12:09

pawelzieba