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

发布于 2024-10-10 04:25:08 字数 115 浏览 6 评论 0原文

谷歌搜索后,当有来电时,我成功获取了 incoming_number 。 但我仍然找不到如何检测呼叫是否被转发(重定向)。

有什么旗帜什么的吗?

此致, 伊万

After googling I successfully get the incoming_number when there is an incoming call.
But I still cannot find how to detect if the call is forwarded(redirected).

Is there some flag or something ?

Best Regards,
Ivan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

计㈡愣 2024-10-17 04:25:08

为了一个理解。

当呼叫在应答之前被重定向到不同的号码时,称为“呼叫转移”。

转接的呼叫不携带任何数据。

据我了解,您实际上可以创建一个广播接收器

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

}
}

既然您有传入号码,您实际上可以做一个解决方法,确定传入号码“作为拨出呼叫”转发到哪里

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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文