Wednesday, January 23, 2013

Identifying Outgoing call Phone Number Through our Application

How To Identify Outgoing call Phone Number Through our Application 



1. Use BroadcastReceiver.
2. Add Permission to Your Manifest File.


1.Add the following code 

public class OutgoingCallReceiver extends BroadcastReceiver {


   @Override
   public void onReceive(Context context, Intent intent) {
           Bundle bundle = intent.getExtras();

           if(null == bundle)
                   return;


           String phonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);

           Log.i("GetPhoneNumber",phonenumber);
          
           String outgoingNumber =  phonenumber;

           Toast.makeText(context, outgoingNumber , Toast.LENGTH_LONG).show();
   }
}

2.In your Manifest

<receiver android:name=".OutgoingCallReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
            </intent-filter>
        </receiver>

8 comments:

  1. Very informative blog.It is very useful post for android developer and android users as well.

    android application development companies

    ReplyDelete
  2. Excellent ! it is very useful post. This is the forum for help and discussion on Android Application Development. Get you an idea of how to start developing. Android applications.Introduce major Android application concepts.

    Android Application Development

    ReplyDelete