gpt4 book ai didi

android - 调用时获取拨号号码。

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:02:56 25 4
gpt4 key购买 nike

当我在键盘中输入任何号码以及在电话调用电话之前按下通话按钮后,我想在 logcat 中获取该拨号号码。

请参阅下图了解。

enter image description here

我可以在打电话时得到号码,如果可以,我该怎么办?

最佳答案

尝试使用这些解决方案。另请参阅 this

   public class OutgoingCallReceiver extends BroadcastReceiver {

public static final String ABORT_PHONE_NUMBER = "1231231234";

private static final String OUTGOING_CALL_ACTION = "android.intent.action.NEW_OUTGOING_CALL";
private static final String INTENT_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER";

@Override
public void onReceive(final Context context, final Intent intent) {
Log.v(Constants.LOGTAG, "OutgoingCallReceiver onReceive");
if (intent.getAction().equals(OutgoingCallReceiver.OUTGOING_CALL_ACTION)) {
Log.v(Constants.LOGTAG, "OutgoingCallReceiver NEW_OUTGOING_CALL received");

// get phone number from bundle
String phoneNumber = intent.getExtras().getString(OutgoingCallReceiver.INTENT_PHONE_NUMBER);
if ((phoneNumber != null) && phoneNumber.equals(OutgoingCallReceiver.ABORT_PHONE_NUMBER)) {
Toast.makeText(context, "NEW_OUTGOING_CALL intercepted to number 123-123-1234 - aborting call",
Toast.LENGTH_LONG).show();
this.abortBroadcast();
}
}
}
}

关于android - 调用时获取拨号号码。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10860369/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com