问题
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