Am developing functionality in which i wanted to Intent.ACTION_DIAL.
Below is the code which i have tried so far.
Intent callIntent = new Intent(Intent.ACTION_DIAL);
String str = "tel:xxxxxxxxxx"; callIntent.setData(Uri.parse(str));
context.startActivity(callIntent);
However facing below two problems
1) if i tried to retrieve the imei number using "tel:#06#" then it will open the device dialer with '' only. "#06#" is not appearing there.
2) It asks the user to press call button. I dont want user to press the call button. is there any API which will allow me to directly execute "tel"*#06# kind of code from application itself.
EDITED:
I have tried below answer. its invoking dialer with "*#06#" but not showing the IMEI number of the device. if i press the same from device dialer and it showing IMEI number instantly.
All i want is to show the IMEI kind of codes from Application.
Intent callIntent = new Intent(Intent.ACTION_CALL);
String encodedHash = Uri.encode("#");
String ussd = encodedHash + "06" + encodedHash;
startActivityForResult(new Intent("android.intent.action.CALL",
Uri.parse("tel:" + ussd)), 1);
and give this permission in android menifest
<uses-permission android:name="android.permission.CALL_PHONE" />
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.
Is it possible to dial a digit during a phone call via code?
After having started a phone call by an app of course.
For example:
String uri = "tel:999999999";
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(uri));
startActivity(intent);
And now I want to dial some numbers during the call, is it even possible?
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
I created an app to call to number *123456789#, but when the app calls this number, Android just calls *123456789 (without the #).
Could you help me?
You simply have to encode the phone number.
String phonenumber = "*123456789#";
encodedPhonenumber = URLEncoder.encode(phonenumber, "UTF-8");
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + encodedPhonenumber)));
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)