Android capture new outgoing call [duplicate]

旧时模样 提交于 2019-12-07 07:40:03

问题


Possible Duplicate:
Android: Redirect outgoing calls

The requirement is to replace newly dialed number with another one. I have captured the ACTION_NEW_OUTGOING_CALL event and used Intent.EXTRA_PHONE_NUMBER to get the current outgoing number and then I have used setResultData inside my class(which extends BroadcastReceiver) to replace the dialed number. Basically code is,

if (Intent.ACTION_NEW_OUTGOING_CALL.equals(action)) {

   String phonenbr = 
    intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
   Log.d("OutGoingNum", "phonenbr is " + phonenbr);

   if (phonenbr.startsWith("00")) {
    setResultData("12345678");
   } 
  }

My code works fine in Android emulator but on the device the code works only on Redial. It doesnt work when you dial the number via dialpad. Please help.


回答1:


I am guessing that Android won't allow the interception and replacement of a dialed number. It would be far too easy for someone to abuse this.



来源:https://stackoverflow.com/questions/3493287/android-capture-new-outgoing-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!