Question

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

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top