tags:

views:

60

answers:

1

Looking through forums, it seems that there is not a way to end calls, but on the Android Developers page, the permission PROCESS_OUTGOING_CALLS "Allows an application to monitor, modify, or abort outgoing calls." I can't find any documentation on how to end a call even with this permission. Is this possible, or is it just a mistake on the page?

http://developer.android.com/reference/android/Manifest.permission.html#PROCESS_OUTGOING_CALLS

A: 

The attention is not to end call that is already started, but to drop the call before that was started. The meaning is - you dial some number , press send , program receives the call request and aborts it , so the call never starts. It is also possible just to change the phone number (to extend short numbers to full one, etc.) and pass the call. It works fine:

    public class phoneReceiver extends BroadcastReceiver {
      public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
        abortBroadcast();
        if (getResultData()!=null) {
          String number = null;
          setResultData(number);
        }
      }
    }
}
Tony