简体   繁体   English

Android - 如何检测来电是否被重定向?

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

After googling I successfully get the incoming_number when there is an incoming call. 谷歌搜索后,当有incoming_number时,我成功获得了incoming_number 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" 由于您有传入号码,您实际上可以执行一种解决方法,确定传入号码转发的位置“作为拨出电话”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM