How to abort an outgoing call after fixed seconds?

落花浮王杯 提交于 2019-12-25 05:56:20

问题


I am working on android app which can make missed call on other phone of particular duration like 5, 10 seconds, I am struck once call is made through a program to a particular number my program loose control, how I can end after some fixed no. of seconds after call is made, the general purpose SDK only allow to initiate call not for abortion.

I am new to android and done a deep search on net about this some folks refer using JAVA reflection and internal telephony for this but I wasn't able to do it, although I have done this on Symbian s-60 platform.

Any Suggestion?


回答1:


use telephony.aidl interface it consist method named endCall() which is used to terminate on going call

start timer in onReceive() method of broad cast receiver when your call is in Ringing state or in off-hook state

use endCall() method in that timer

Let me know if you need more things from me




回答2:


    import android.content.BroadcastReceiver;
     import android.content.Context;
     import android.content.Intent;
     import android.util.Log;
     import android.widget.Toast;

     public class OutgoingCallReceiver extends BroadcastReceiver {


         @Override
         public void onReceive(Context context, Intent intent) {
    if(intent.getAction().equals(Intent.NEW_OUTGOING_CALL))
     {
       abortBroadcast ();
       }
    }
      }

Requires

<uses-permission android:name="android.permission.CALL_PHONE"/>


来源:https://stackoverflow.com/questions/14066574/how-to-abort-an-outgoing-call-after-fixed-seconds

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