Call forwarding - android

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);

Related

How to pass a comma ',' character to ACTION_DIAL intent in Android

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

Android phone call including comma and hash #

I need to make automatic phone call app with this two character (comma and hash).
I try with this method. If so, all character behind hash is not called.
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" +"131#3131,,,44"));
startActivity(intent);
So, I try with this method again. Then, all number behind comma is not called. May I know how to do?
Intent out = new Intent();
out.setAction(Intent.ACTION_DIAL);
out.setData(Uri.parse("tel:" + Uri.encode("+3943#333,,23")));
startActivity(out);
Here is the answer (copied)
Uri.parse(String.format("tel:%s", Uri.encode(number)))
Source Intent.ACTION does not dial after first # sign

How to make a special number phone call in Android ending with #

I'm a new android application programmer.
I created a button in my application that calls a number ie. *144# but it keep ignoring the # and dialing *144 only.
How do i ensure it calls the whole number?
Code Snippet:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:*144#"));
startActivity(callIntent);`
Url encode it.
String number = "tel:*144%23";
callIntent.setData(Uri.parse(asd));
Or if you need a more general approach (like if you numbers change...) - encode the data part of the URI with a URLEncoder.
String number = "tel:"+ URLEncoder.encode("*144#");
....
Simple use Uri encode :
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+ Uri.encode("*144#")));
startActivity(callIntent);
You can try this:
Intent callIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:*144" + Uri.encode("#")));
startActivity(callIntent);
it worked for me.
# is a special character that sends command to operator. I don't think that you can actually call any number ending with #.

android starting a phone call intent with # in the URI

I tried do the below for a phone call intent and I still keep getting the "#" removed from the number been called. Please see code below... The # at the end get translated into a %23 on printing out the contents of the string to a console. I am testing on a Samsung S4 phone which then generates a USSD code error running. Is there something wrong with the phone or the code below
Intent phoneCallIntent = new Intent(Intent.ACTION_CALL);
phoneCallIntent.setData(Uri.parse("tel:" + Uri.encode("*222*"+ rechargeNumber + "#");));
startActivity(phoneCallIntent);
don't use Uri.encode().
Use the following code. I think it will help you.
String uri = "tel:" +"*222*"+ rechargeNumber + "#" ;
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(uri));
startActivity(intent);
Intent you're looking for is android.intent.action.CALL_PRIVILEGED.
This might be helpful to you
using android dialer in 3rd party app

Android Problem with special character phone numbers and ACTION_CALL

I found a problem which I can't find solution, maybe someone has seen this before?
I use this to perform a call, now if the call is a special number such as *111#, the character # is not sent to the activity, resulting in a call to *111 without the # character.
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
Anyone understand what happens?
You should url-encode your tel:*111#:
String telUri = "tel:" + Uri.encode("*111#");

Categories

Resources