tags:

views:

33

answers:

0

Hi all,

I want to end the outgoing call after few seconds..here is my code..

public class phonecalls extends Activity {
 ComponentName cn;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    call();
}
private void call() {
try {
    Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:123456789"));
    startActivity(callIntent);

           cn = new ComponentName(getApplicationContext(), Receiver.class);

    } catch (ActivityNotFoundException activityException) {
    Log.e("dialing-example", "Call failed", activityException);
}
}
}

Ad my receiver class is..

public class Receiver extends BroadcastReceiver {
      public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
         setResultData(null);
                }
      }
    }

But i am unable to abort the call.. Please help me how to abort the out going call..I am new to android and i need this madly..