I'm new to Android, so is there a way to automatically call a number (or at least put it in the phone's dialer) when an app is opened? (the app needs no GUI, it just needs to call when opened)
Thank you for your time!
I'm new to Android, so is there a way to automatically call a number (or at least put it in the phone's dialer) when an app is opened? (the app needs no GUI, it just needs to call when opened)
Thank you for your time!
To make a call,
private void performDial(String numberString) {
if (!numberString.equals("")) {
Uri number = Uri.parse("tel:" + numberString);
Intent dial = new Intent(Intent.ACTION_CALL, number);
startActivity(dial);
}
}
Add this permission into manifest.
<uses-permission android:name="android.permission.CALL_PHONE" />
refer this
Put this code inside onCreate() of activity
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:0123456789"));
startActivity(intent)
Also give calling permission inside android manifest file. Permission :