Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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().

like image 396
user1029593 Avatar asked Jan 10 '12 09:01

user1029593


1 Answers

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>
like image 188
Parag Chauhan Avatar answered Oct 05 '22 11:10

Parag Chauhan