CALL_STATE_OFFHOOK : 통화중인 상태

CALL_STATE_RINGING : 폰이 울리고 있는 상태

CALL_STATE_IDLE : 폰이 울리거나 통화중이 아닌 상태

public class MyPhoneStateListener extends PhoneStateListener { 
        @Override 
       public void onCallStateChanged(int state, String incomingNumber){

         if (state == TelephonyManager.CALL_STATE_IDLE) {
                Log.i("PhoneCallState", "STATE_IDLE");
         }
         else if (state == TelephonyManager.CALL_STATE_RINGING) {
                Log.i("PhoneCallState", "STATE_RINGING : Incoming number "+incomingNumber);
         }
         else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
                Log.i("PhoneCallState", "STATE_OFFHOOK");
         }
        }
    }

+ Recent posts