I am using this:
public void onCallStateChanged(int state, String incomingNumber)
which is listening to:
telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE);
I want to know both outgoing and incoming calls but for now I only get incoming calls (when state changes is ringing). Can anyone tell me when can I detect outgoing call and its end
Also is there a way to simulate outgoing calls in Eclipse emulator. was able to do that for incoming calls via emulator control in eclipse.
Use a broadcast listener with an intent
android.intent.action.NEW_OUTGOING_CALL
string parametrer for theIntentFilter
and don't forget to give permission in AndroidMenifest toPROCESS_OUTGOING_CALLS
. This will work. Whenever there is an outgoing call a toast message will be shown. Code is below.Create a new class, let say MyPhoneReceiver, extends it from BroadcastReceiver, and implement onReceive method.
In another class, let say, MainActivity.class inside onCreate method. for example.
In the AndroidManifest.xml
and also in the AndroidManifest.xml, add: