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>