Android 删除 未接来电 通知
2010-11-05 00:56:25 来源:WEB开发网Java代码
@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);
}
- ››Android 当修改一些代码时,使用什么编译命令可以最...
- ››Android 如何添加一个apk使模拟器和真机都编译进去...
- ››Android 修改Camera拍照的默认保存路径
- ››Android 如何修改默认输入法
- ››android开发中finish()和System.exit(0)的区别
- ››Android手势识别简单封装类
- ››android中查看项目数字证书的两种方法
- ››Android中获取IMEI码的办法
- ››android 相机报错 setParameters failed
- ››Android重启运用程序的代码
- ››Android为ListView的Item设置不同的布局
- ››android bitmap与base64字符串的互相转换
赞助商链接