1

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

2 Answers2

0

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);
Praveen Sharma
  • 4,326
  • 5
  • 25
  • 45
  • This was my initial code before I changed it to the one above after reading this post. http://stackoverflow.com/questions/11774884/android-how-to-make-a-call-that-includes-or-p-in-the-dial – user3381784 Mar 06 '14 at 11:53
0

Intent you're looking for is android.intent.action.CALL_PRIVILEGED. This might be helpful to you using android dialer in 3rd party app

Community
  • 1
  • 1
ShahrozKhan91
  • 710
  • 10
  • 19