Android Check if call forwarding is activated

后端 未结 4 1910
醉酒成梦
醉酒成梦 2021-01-13 21:19

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

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 22:06

    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);
            }
    
        }
    }
    

提交回复
热议问题