I'm trying to call a complex number with the ACTION_CALL intent, similar to a calling card. It looks something like this: (Calling card phone number, calling card pin, actual number to dial.)
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:18005551234,987654#,14325558765");
startActivity(callIntent);
However, when the dialer comes up, it only dials the 800 number at the start of the sequence and ignores the rest.
How can I get it to dial the entire number?
It appears this works if you encode the number.
String num = "tel:"+Uri.encode("18005551234,987654#,14325558765");
Note that including "tel:" inside the Uri.encode() call also encodes the :, which breaks the URI.
Related
I am trying to dial the number with extension:
Uri number = Uri.parse("tel:0008001009009,1");
Intent callIntent = new Intent(Intent.ACTION_CALL,number);
startActivity(callIntent);
This is working in some devices, but for some devices like Nexus 4 its not working. Its not taking the extension number.
PhoneNumberUtils.WAIT i.e " ; " is working , but in this case input is required from user.
PhoneNumberUtils.PAUSE i.e " , " is for Automatic dialing the extension.
I want to dial the extension automatically. Any solution ?
Try sending ACTION_DIAL intent to check what is the number being displayed on other devices.
Else append with + on the number and invoke ACTION_DIAL or ACTION_CALL.
I would like to be able to pass commas ',' into an Action_dial intent. A comma is used for a pause when pressing numbers for an automated phone menu system.
These can be placed in numbers in Contacts and it will work fine but when trying to Parse or Encode a URI to pass this into the Action_Dial intent, it passes the number in right up until the ',' and then will not pass anything after the ','.
I have tried several different ways of doing this several different ways.
Such as...
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:14051234567,,3,1"));
startActivity(intent)
and..
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.fromParts("tel", "14051234567", ","));
startActivity(callIntent);
and
Intent callIntent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + Uri.encode("14051234567")+ Uri.encode(",")));
and every other way that I've found here on StackOverflow.
Is there a way to make this happen?
EDIT-
Maybe this can't be made to work?? I just ran across this Android Bug report that was closed by Google but not ever fixed. Lame Google.
https://code.google.com/p/android/issues/detail?id=7993
At the moment I receive a phone number from a the backend and use this in an intent so the user can call the number.
Intent callIntent = new Intent(Intent.ACTION_DIAL);
TaxiItemView taxiItemView = (TaxiItemView) view;
callIntent.setData(Uri.parse("tel:" + taxiItemView.getPhoneNumber()));
startActivity(callIntent);
I don't receive an international-pre-fix so what would happen in this case? If a user is in a different country than the sim in the phone, and then they dial a number without the international pre-fix. Does the phone take the prefix of the country it is in or does it use the pre-fix of the simcard?
Do I need to append the correct pre-fix on this number to ensure the correct number is called?
I am trying to call a USSD number from my application like this:
Uri u = Uri.fromParts("tel", "*110#", "");
Intent i = new Intent(Intent.ACTION_CALL, u);
startActivity(i);
This makes the phone app launch and call the number.
What I want is to call the USSD number without opening the phone app or atlease open it up in the background.
If the user is doing something, then he should not be disturbed. Only a notification must be generated.
any suggestions?
it is possible now since android O(api 26) with sendUssdRequest() check the docs https://developer.android.com/reference/android/telephony/TelephonyManager.html#sendUssdRequest(java.lang.String,%20android.telephony.TelephonyManager.UssdResponseCallback,%20android.os.Handler)
I would like to forward all calls to my number on to the new predefined number
automatically. Is it possible to forward incoming call ?
Probably it is possible for Froyo at least. I found application called Easy Call Forwarding.
http://www.appstorehq.com/easycallforwarding-android-189596/app
But many people reckon it doesn't work actually.
We can notice forwarded call by onCallForwardingIndicatorChanged() from PhoneStateListener but
I have no idea how to set forwarding mode.
I explored on the net and got the answer to my question that how one can forward a call programmatically. Add these lines of code and one will be able to achieve it.
String callForwardString = "**21*1234567890#";
Intent intentCallForward = new Intent(Intent.ACTION_DIAL); // ACTION_CALL
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
startActivity(intentCallForward);
Here 1234567890 represents the phone number. Add the approriate phone number as you wish here. One can dial ##21# to deactivate the service.
My solution:
Intent intent = new Intent(Intent.ACTION_CALL);
String prefix = "#31#";
prefix = Uri.encode(prefix);
intent.setData( Uri.parse("tel:"+prefix+"123456"));
startActivity(intent);