使用Notification通知来显示接收的短信内容
2013-06-06 21:07
344 查看
关键代码:
1.in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
保证我所启动的Activity位于栈顶,作用将当前栈顶的Activity移除
2.PendingIntent pi = PendingIntent.getActivity(ReceivedSMSService.this,
id, in, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT:这个标志位可保证当PendingIntent中包装的Intent的数据改变时,系统给我重新来创建PendingIntent
3.id++;
PendingIntent pi = PendingIntent.getActivity(ReceivedSMSService.this, id, in, PendingIntent.FLAG_UPDATE_CURRENT);
mNotificationManager.notify(id, mNotification);
id这个变量起到了关键性的作用:处理多个通知
程序完整代码:
相关文章推荐
- Android使用BroadCastRecevier广播实现接收短信,并利用Toast弹出显示内容
- Android使用BroadCastRecevier广播实现接收短信,并利用Toast弹出显示内容
- Android使用ContentObserver监听数据库变化,截取系统通知用户接收到短信
- Notification消息通知(消息合并且显示条数,自定义消息通知内容布局)
- 使用 Notification 在状态栏中显示一个通知。
- 在ios5 中 使用通知机制(notification ) 来显示一个消息(banner 和 alert)
- BroadcastReceiver与Notification的结合使用实现短信完全自主接收
- Android 使用Notification自定义通知栏显示
- 通知栏Notification使用自定义视图方法(显示一个进度条ProgressBar)
- 使用Edge模式通知Internet Explorer以最高级别的可用模式显示内容
- 【Android开发】消息提示框与对话框-使用Notification在状态栏上显示通知
- Android--使用Notification在通知栏显示消息
- Android使用Notification在状态栏上显示通知
- 通知栏Notification使用自定义视图方法(显示一个进度条ProgressBar)
- 使用Edge模式通知Internet Explorer以最高级别的可用模式显示内容
- Android4.1:通知栏显示可点击的按钮-Notification.builder Sample
- android通知栏之Notification的使用
- [给力原创]使用jQuery-ajax仿新浪微博通知折叠/显示效果,实现数据加载(二)
- Notification通知的使用