`
helpbs
  • 浏览: 1165199 次
文章分类
社区版块
存档分类
最新评论

android notification

 
阅读更多

在做一个应用的时候用到一个notification通知,可是当点击了notification之后,这个notification仍然还在,这里做个记录:


Intent intent = new Intent(HelperMain.this,Calllog.class);//要跳转的activity

PendingIntent pendingIntent = PendingIntent.getActivity(HelperMain.this, 0, intent, 0);
mNotification = new Notification();
mNotification.icon = android.R.drawable.ic_dialog_info;
mNotification.tickerText = missedCall;
// mNotification.defaults = Notification.DEFAULT_SOUND;
mNotification.flags |= Notification.FLAG_AUTO_CANCEL;//这里就是可以自动在点击之后消失关键
mNotification.setLatestEventInfo(HelperMain.this, "未接来电", "未接来电", pendingIntent);
//执行notification
mNotificationManager.notify(12313, mNotification);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics