Java Code Examples for android.content.Intent#ACTION_NEW_OUTGOING_CALL

The following examples show how to use android.content.Intent#ACTION_NEW_OUTGOING_CALL . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
 * Broadcast receiver to check outgoing call
private void initOutgoingBroadcastReceiver() {
    OutgoingBroadcastReceiver = new BroadcastReceiver() {

        public void onReceive(Context context, Intent intent) {

            if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {

                isInCall = true;

                if (isInCall == true) {
                    smallMediaPlayer = SmallMediaPlayer.getInstance(context);
                    bigNotification = false;

    IntentFilter filter = new IntentFilter(Intent.ACTION_NEW_OUTGOING_CALL);
    context.registerReceiver(OutgoingBroadcastReceiver, filter);
Example 2
public void activityShouldGetCorrectIntentData() {
    // prepare data for onReceive and call it
    Intent intent = new Intent(Intent.ACTION_NEW_OUTGOING_CALL);
    intent.putExtra(Intent.EXTRA_PHONE_NUMBER, "01234567890");

    mReceiver.onReceive(mContext, intent);

    // what did receiver do?
    verify(mContext, times(1)).startActivity(captor.capture());
    Intent receivedIntent = captor.getValue();
    assertEquals("01234567890", receivedIntent.getStringExtra("phoneNum"));
    assertTrue((receivedIntent.getFlags() &
            Intent.FLAG_ACTIVITY_NEW_TASK) != 0);