Пример #1
0
 @Override
 public void onReceive(Context context, Intent intent) {
   String number = getResultData();
   String address = AddressDB.getAddress(number);
   // ToastUtils.showToast(context, address);
   showToast(address);
 }
Пример #2
0
 @Override
 public void onCallStateChanged(int state, String incomingNumber) {
   switch (state) {
     case TelephonyManager.CALL_STATE_RINGING: // 电话响了
       Log.e("AddressService", "来电话了");
       String address = AddressDB.getAddress(incomingNumber);
       // ToastUtils.showToast(getApplicationContext(), address);
       showToast(address);
       break;
     case TelephonyManager.CALL_STATE_IDLE: // 电话闲置状态
       if (windowManager != null) {
         windowManager.removeView(view); // 移除view
       }
   }
   super.onCallStateChanged(state, incomingNumber);
 }