技术开发 频道

Android 开发总结之获取来电号码

  case TelephonyManager.CALL_STATE_OFFHOOK:

  Log.d(TAG, "OFFHOOK");

  break;

  }

  }

  }

  public class CustomPhoneStateListener extends PhoneStateListener {

  private static final String TAG = "CustomPhoneStateListener";

  @Override

  public void onCallStateChanged(int state, String incomingNumber){

  Log.v(TAG, "WE ARE INSIDE!!!!!!!!!!!");

  Log.v(TAG, incomingNumber);

  switch(state){

  case TelephonyManager.CALL_STATE_RINGING:

  Log.d(TAG, "RINGING");

  break;

  case TelephonyManager.CALL_STATE_IDLE:

  Log.d(TAG, "IDLE");

  break;

  case TelephonyManager.CALL_STATE_OFFHOOK:

  Log.d(TAG, "OFFHOOK");

  break;

  }

  }

  }

  Java代码


0
相关文章