Reputation: 105
I try to use GSM codes to transfer my calls with an android app. For example, if I call : **21*otherNumber# All my calls will be transfered on otherNumber.
My code:
Uri transfert = Uri.parse( "tel:**21*" + numero + "#");
Intent intent = new Intent( Intent.ACTION_CALL, transfert );
startActivity(intent);
However, Uri.parse() has for definition: " A URI reference includes a URI and a fragment, the component of the URI following a '#' "
So, it removes the # but I need it. The GSM code can't works without it.
Somebody would have an idea ?
Upvotes: 2
Views: 2729
Reputation: 88
You need to send a URI encoded hash to parse it through the URI.
public static final String encodedHash = Uri.encode("#");
It will keep the URI encoded hash and send the USSD message over GSM as you have specified.
Upvotes: 0
Reputation: 93842
I don't think you can't dial phone number with extensions, it's a known issue (see this).
According to this thread, you may try to add %23
like Uri.parse( "tel:**21*" + numero + "%23");
Upvotes: 2