コード例 #1
0
    @Override
    public void onReceive(Context context, Intent intent) {
      String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
      String address = NumberAddressDao.findAddress(NumberAddressService.this, number);

      mToast.show(address);
    }
コード例 #2
0
    @Override
    public void onCallStateChanged(int state, String incomingNumber) {
      // 响铃状态显示号码归属地
      if (state == TelephonyManager.CALL_STATE_RINGING) {
        String address = NumberAddressDao.findAddress(NumberAddressService.this, incomingNumber);

        mToast.show(address);
      } else if (state == TelephonyManager.CALL_STATE_IDLE) {
        mToast.hide();
      }
    }