@Override    public void onWindowFocusChanged(boolean hasFocus) {        super.onWindowFocusChanged(hasFocus);        // Clear notifications only when window gains focus.  This activity won't        // immediately receive focus if the keyguard screen is above it.        if (hasFocus) {            try {                ITelephony iTelephony =                        ITelephony.Stub.asInterface(ServiceManager.getService("phone"));                if (iTelephony != null) {                    iTelephony.cancelMissedCallsNotification();//删除未接来电通知                } else {                    Log.w(TAG, "Telephony service is null, can't call " +                            "cancelMissedCallsNotification");                }            } catch (RemoteException e) {                Log.e(TAG, "Failed to clear missed calls notification due to remote exception");            }        }    }    private void resetNewCallsFlag() {//修改数据库字段,使改条通话记录不是最新通知  防止机器重新启动后又有未接电话通知        // Mark all "new" missed calls as not new anymore        StringBuilder where = new StringBuilder("type=");        where.append(Calls.MISSED_TYPE);        where.append(" AND new=1");        ContentValues values = new ContentValues(1);        values.put(Calls.NEW, "0");        this.getContentResolver().update(Calls.CONTENT_URI, values, where.toString(), null);    }

更多相关文章

  1. 日拱一卒(十三)
  2. Android(安卓)发送通知
  3. 【notification】Android(安卓)中创建震动通知
  4. Android(安卓)技巧 - notification center 发出通知时显示文字
  5. android 监听短信和来电
  6. 系出名门Android(3) - 对话框(Dialog)和通知(Notification)
  7. Android实现程序前后台切换效果
  8. 在Android(安卓)开发中使用Protobuf的实践和经验分享
  9. Android(安卓)通知总结

随机推荐

  1. android 使用xmpp smack openfire实现即
  2. android之基于Echart的图表
  3. Android中铃声总结【安卓源码解析一】
  4. Android手动清除APP中Data目录下的文件
  5. Android(安卓)8.0源码编译问题记录
  6. Android(安卓)彩色上下文菜单 Context
  7. Android(安卓)webview ajax session 问题
  8. getSystemService 的参数
  9. Android线程池的详细说明(一)
  10. 关于android与h5互调简介