Skip to content Skip to sidebar Skip to footer

Dialing With Intent.action_call Stopps At # In Phone Number

I try to dial the phone number 03012345,1234,#31#,98765 (callthrough with a FRITZ!Box) '03012345' is the phone number of the FRITZ!Box, ',' are dial pauses, '#31#' is a prefix to s

Solution 1:

Here is the solution:

Stringphonenumber="03012345,1234,#31#,98765"; // , = pauses
encodedPhonenumber = URLEncoder.encode(phonenumber, "UTF-8");
startActivity(newIntent(Intent.ACTION_CALL, Uri.parse("tel:" + encodedPhonenumber)));

You simply have to encode the phone number.

Solution 2:

Really late on the answer, but another way that this can be done is with Uri.Builder. Using encodedPath() assumes that the string you're passing is already encoded, so it will be added to the Uri as is:

finalStringphonenumber="03012345,1234,#31#,98765";
finalUriuri=newUri.Builder().scheme("tel").encodedPath(phonenumber).build();
startActivity(newIntent(Intent.ACTION_CALL, uri));

Post a Comment for "Dialing With Intent.action_call Stopps At # In Phone Number"