2

I want to start a new activity once an outgoing call is activated (NEW_OUTGOING_CALL). However I dont know where I should start my new activity in the PhoneStateListener class that I created (method onCallStateChanged) Where do I start my intent?CALL_STATE_IDLE?CALL_STATE_OFFHOOK?

public void onCallStateChanged(int state, String incomingNumber) {
    switch (state) {
    case TelephonyManager.CALL_STATE_IDLE: 
        Log.d("System out", "IDLE");
        NOTOFFHOOK = true;      
        break;
    case TelephonyManager.CALL_STATE_OFFHOOK:  method called
        Log.d("System out", "OFFHOOK, it flag: " + NOTOFFHOOK);

        if (NOTOFFHOOK == false) {
            // do your work on receiving call.
        }
        break;
    case TelephonyManager.CALL_STATE_RINGING:   
        Log.d("System out", "RINGING");
        // do your work while ringing.

        break;
    }
}
user1163234
  • 2,407
  • 6
  • 35
  • 63
  • You can't. See: https://stackoverflow.com/questions/2250455/detect-if-an-outgoing-call-has-been-answered – dcow Mar 07 '12 at 20:43
  • I think your above responce has to do with incoming call? I need to get the outgoing call...Thanks! – user1163234 Mar 07 '12 at 20:50
  • I haven't checked it but I would think that an outgoing call would also 'ring', albeit on the internal speaker. It's still ringing though. Does it not work to start your new activity under the CALL_STATE_RINGING case? – dcow Mar 07 '12 at 20:54
  • Ringing state never happens for an outgoing call in android. Only Offhook or Idle. – Dheeraj Bhaskar Mar 20 '14 at 20:29

0 Answers0