-1

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!

Cœur
  • 37,241
  • 25
  • 195
  • 267
iNoyz
  • 3
  • 1
  • see if [this answer](http://stackoverflow.com/a/4816772/2761813) helps, just tried a fast google search... – Ayoub Nov 19 '14 at 11:53

2 Answers2

1

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

Community
  • 1
  • 1
Darish
  • 11,032
  • 5
  • 50
  • 70
0

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 :

Makwana
  • 70
  • 10
Amit
  • 13,134
  • 17
  • 77
  • 148