Varun Agarwal Varun Agarwal - 1 year ago 96
Android Question

Android Check if call forwarding is activated

I am building a call forwarding application and have used the **21*xxxxxx# ussd code to activate call fowarding using ACTION_CALL Intent. But I have not found a solution to check whether Call forwarding is active or not.

Is there any solution to check from the android system if call forwarding is active or not?

Answer Source

you can make Brodcast class register it and you can track out going call like

public class CallBroadcastReceiver extends BroadcastReceiver
    public static String numberToCall;
    public void onReceive(Context context, Intent intent) {
        Log.d("CallRecorder", "CallBroadcastReceiver::onReceive got Intent: " + intent.toString());
        if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
            numberToCall = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
            Log.d("CallRecorder", "CallBroadcastReceiver intent has EXTRA_PHONE_NUMBER: " + numberToCall);