I'm using the following code to make a call in Android but I would like to hide the number being called, and not save it in the call log. Is it possible?
String num="xxx-xxx-xxx";
String number = "tel:" + num.trim();
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number));
startActivity(callIntent);
Related
I want to do this for my school project I want call from my app to show imei number so I want # also to be copied to phone call.But when I am executing the below code only the * is copied to phone call area
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + "*#06#"));
startActivity(intent);
in order to call USDD codes you have to use something like this :
String code = "*" + Uri.encode("#") + "06" + Uri.encode("#");
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + code)));
and don't forget to use the call permission in your manifest :
<uses-permission android:name="android.permission.CALL_PHONE"/>
I am using this:
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone));
startActivity(callIntent);
finish();
to do phone calls and it works great, but now I have to do some international calls from the app, where I should use the plus' sign (+) to identify the country (ex: +01198765432)
How may I do this without get any error?
You need to ad "+" sign in phone number:
Like this:
String phone="+123456789"
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+phone));
startActivity(callIntent);
I want to open my phone dialer .But it shows error. I have declared permissions for CALL_PHONE on Android Manifest and also declared class in Android Manifest.
case R.id.action_call:
Log.d("Action_call","INside Action call");
Intent dialer = new Intent(Intent.ACTION_DIAL);
startActivity(dialer);
return true;
You don't need any permissions for ACTION_DIAL Intent. So remove CALL_PHONE permission from AndroidManifest.xml.
You have not pass any number to fire dial Intent.
Use tel: followed by the phone number as the value passed to Uri.parse():
Try this code.
String number = "1234567890";
Uri number = Uri.parse("tel:" + number);
Intent dial = new Intent(Intent.ACTION_DIAL);
dial.setData(number);
startActivity(dial);
EDIT:
You can first check whether telephony is supported on device
private boolean isTelephonyEnabled(){
TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
return tm != null && tm.getSimState()==TelephonyManager.SIM_STATE_READY
}
I hope it helps!
Use Uri to parse number..
Intent call = new Intent(Intent.ACTION_DIAL);
call.setData(Uri.parse("tel:"+phone)); //String phone
startActivity(call);
Use try/catch.
Use Uri to parse number.
Don't need any permissions for ACTION_DIAL intent.
try{
Intent call_intent = new Intent(Intent.ACTION_DIAL);
call_intent.setData(Uri.parse("tel:"+phone_number));
startActivity(call_intent);
}catch(Exception e){
}
So I'm trying to send a number via Intent.ACTION_DIAL ending with # i.e for example *123#. But when the Android Dialer app is started, there is only *123 (# is missing).
I'm using following code to trigger the Dial Application of Android.
Uri number = Uri.parse("tel:*124#");
Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
context.startActivity(callIntent);
Anticipated Thanks!!
.
You need to properly encode the hash tag (#). In your URL requests it should be %23, so replacing it with %23 will do the trick.
Uri number = Uri.parse("tel:*124%23");
Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
context.startActivity(callIntent);
You can also let URI do the encoding:
String encodedPhoneNumber = String.format("tel:%s", Uri.encode("*1234#"));
Uri number = Uri.parse(encodedPhoneNumber);
Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
context.startActivity(callIntent);
The answer could be related with this link
initiate a phone call on android with special character #
This line could be the key
Uri.parse("tel:"+Uri.encode("*124#"));
I am trying the below code to dial a number, but it always dail as *111
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:*111#"));
startActivity(callIntent);
Please help i am trying to learn android..
Thanks friends..
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+ Uri.encode("*111#")));
startActivity(callIntent );
Happy Coding :)