android – 在拨打电话时拨号.

当我在键盘中输入任何数字,然后在电话拨打电话之前按通话按钮,我想在logcat中获得该拨号号码.

看到下面的图片了解.

我可以在通话时收到号码,如果是,那么我该怎么办?

解决方法

尝试使用这些解决方案.还请参考 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性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...