How to launch android.intent.action.CALL in service?

user1029593 picture user1029593 · Jan 10, 2012 · Viewed 10.4k times · Source

How to launch android.intent.action.CALL (to get USSD) code in service?

My Code:

protected void call(String phoneNumber) {
    try {
        startActivityForResult(
            new Intent("android.intent.action.CALL", Uri.parse("tel:"
                + phoneNumber)), 1);
    } catch (Exception eExcept) {
        //this.view.append("\n\n " + "\n" + eExcept.toString());
    }
}

This code does not work, the problem with startActivityForResult().

Answer

Parag Chauhan picture Parag Chauhan · Jan 10, 2012

This is the intent for call

 Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+phoneno));
   startActivity(intent);

& Dont miss the Add permission in Maniefiest

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>