Android菜鸟日记16
notification

notificationManager = (NotificationManager) ct
.getSystemService(ct.NOTIFICATION_SERVICE);
Notification notificaiton = new Notification(id, tickerTexT,
System.currentTimeMillis());
// 这个ID是notificaiton id
// 创建notification对象
PendingIntent ci = PendingIntent.getActivity(ct, 0, it, 0);
// PendingIntent为系统android 对象 负责可以脱离程序负责 notificaiton
notificaiton.setLatestEventInfo(ct, contentTitle, contentText, ci);
// 设置notification信息
notificationManager.notify(id, notificaiton);
// 这里的id是放入的图片R.DRAW.XX这个指向ID
// 这里的id可以和上面一样(我写的是一样的),也可以不一样 但是这里的id必须是图片指向id 上面的notificaiton id则无所谓。
// 但是一般使用的时候直接用图片的指向id 作为notificaiton的id.
// 对notificationManager传入notificaiton的ID和notificaiton对象。


使用notification
1.首先要从系统中获取NotificationManager服务
2.然后实例化Notification对象。
3.将当前活动注册到PendingIntent对象
活动注册到==PendingIntent传入=Notification
当活动关闭了。 Notification依旧可以通过PendingIntent去开启活动。
PendingIntent是由android系统负责维护的。
4.给Notification对象赋值。//(ct,contentTitle,contentText,ci);
5. notificationManager对象发出通知
通过notificationManager.notify(id, notificaiton)
将notificaiton对象发出。


2011-9-16
poolo

更多相关文章

  1. android 获取当前系统的语言
  2. android 将图片转换成二进制,再讲二进制转换成图片 可用于编码加
  3. 修改Android系统目录的读写权限命令
  4. 华为发布全新IDE:DevCro Studio,Facebook正自研OS系统!去除Google安
  5. 昨日看了一本书《Android技术内幕.系统卷》
  6. Android 系统中 gps Location Service 的实现与架构,本文可以帮助

随机推荐

  1. Android学习摘要一之Android历史
  2. Handler消息机制深入学习
  3. 【android】编程规范、常用技巧和性能优
  4. 【Tensorflow】Tensorflow移植Android上
  5. 3G之Android学习第三章节>
  6. Android集成测试
  7. Android(安卓)技术: 追踪vm 如何调用基础
  8. 安卓安全——读书笔记
  9. 使用chrome调试android前端页面
  10. Flutter 入门篇一(解决无法连接设备问题)