Пример #1
0
 @Override
 public void onReceive(Context context, Intent intent) {
   Log.i(TAG, "我是服务内部的广播接受者,有电话打出去了。。。");
   String phone = getResultData();
   String result = AddressDao.getAddress(phone);
   // Toast.makeText(context, result, 1).show();
   showMyToast(result);
 }
Пример #2
0
 // 当呼叫的状态发生变化的时候 调用的方法
 @Override
 public void onCallStateChanged(int state, String incomingNumber) {
   super.onCallStateChanged(state, incomingNumber);
   switch (state) {
     case TelephonyManager.CALL_STATE_RINGING: // 响铃状态
       String address = AddressDao.getAddress(incomingNumber);
       // Toast.makeText(getApplicationContext(), address, 1).show();
       showMyToast(address);
       break;
     case TelephonyManager.CALL_STATE_IDLE: // 空闲状体
       if (view != null) {
         wm.removeView(view);
         view = null;
       }
       break;
   }
 }