Reputation: 755
Hi I'm making an application to automate/activate call forwarding via sms all are working except of parsing some characters for the call forwarding code..
this is my code to execute the call forwarding code which is documented here: http://en.wikipedia.org/wiki/Call_forwarding#Keypad_codes
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+Uri.encode("#")+Uri.encode("#")+"21"+Uri.encode("#")));
((Intent)callIntent).addFlags(268435456);
this.context.startActivity((Intent)callIntent);
the code to cancel the call is ##21# but my application always got an error and looks like it cannot read my command as posted above but if I will dial it manually it is fine..
Upvotes: 0
Views: 566
Reputation: 3185
Try using ACTION_DIAL rather than ACTION_CALL for the **21* and ##21#.
Check out this link as well, I think it addresses your problem specifically.
Here's the TLDR:
String uri = "**21*268435456#"; // ##21#268435456#
Intent intent = new Intent(Intent.ACTION_DIAL); // ACTION_CALL
Uri uri2 = Uri.fromParts("tel", uri, "#");
intent.setData(uri2);
startActivity(intent);
Upvotes: 1