开发者

Android - How to detect if the incoming call is redirected?

开发者 https://www.devze.com 2023-02-02 10:15 出处:网络
After googling I successfully get the incoming_number when there is an in开发者_高级运维coming call.

After googling I successfully get the incoming_number when there is an in开发者_高级运维coming call. But I still cannot find how to detect if the call is forwarded(redirected).

Is there some flag or something ?

Best Regards, Ivan


For an understanding.

When a call is redirected to a different number before it is answered is referred as “Call Forward”.

Forwarded calls do not not carry any data with them.

From what I understood, you can actually create a broadcast receiver

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

}
}

Since you have the incoming number, you can actually do a workaround, determining that to where the incoming number was forwarded "as an outgoing call"

0

精彩评论

暂无评论...
验证码 换一张
取 消