I want open function call phone of android but don't set phone number default as
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:09340125465"));
startActivity(callIntent);
I want to open call phone and after input phone number.
Hope you me. Thanks.
Use this code:
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:"));
startActivity(callIntent);
Related
I am trying to write a code to whatsapp call a mobile number, without saving it to the phonebook.
I have written the code as:
Intent callIntent = new Intent("android.intent.action.MAIN");
callIntent.setComponent(new ComponentName("com.whatsapp", "com.whatsapp.Conversation"));
callIntent.putExtra("jid", "19876543210#s.whatsapp.net");//phone number without "+" prefix
callIntent.putExtra(Intent.EXTRA_TEXT, "voip-call");
callIntent.putExtra("call", true);
callIntent.setAction(Intent.ACTION_CALL);
callIntent.setPackage("com.whatsapp");
startActivity(callIntent);
But it is not working.
Any sort of help would be beneficial for my learning.
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'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 #.
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 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