android中如果当前收到新的email会在status bar中显示一个表示新mail的图标,然后发出提示声音.我现在要单独做一个应用程序实现这个功能,请问我要怎么要才能获取到notification发出来的消息以及内容?
解决方案 »
- 求如何获取手机SD卡上的xml用dom4j来解析
- [下载]从Gmail中下载的附件,在下载内容中该附件的文件名显示重复
- 如何实现,在服务端下载到手机客户端的视频,这样的播放器,边下载边播放
- Android setOnClickListener
- android程序 报错get data from file(xxx/xx/xx.png) failed
- 大家做天气预报用的是哪个接口?
- 初学Android,求大家看看这个是不是button,为什么这样定义
- android编程,如何把硬件摄像头捕获到的jpg格式图像转换为bmp,从而进行其他的图像处理?
- android 划掉子进程的task之后主进程task也被关闭,请问这是为什么?
- android9.0无法连接指定wifi
- Android上如何创建一个UI
- android2.1读取联系人 排序如何实现
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.mz,"通知",
System.currentTimeMillis()); Intent newintent = new Intent(context,DownLoad.class);
newintent.putExtra("height", 123);//存入数据
newintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
newintent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(
context,
0,
newintent,
0
); notification.setLatestEventInfo(context,
"资源下载",
"资源下载中...",
pendingIntent);
notification.flags|=Notification.FLAG_ONGOING_EVENT; //一直存在
notification.defaults |= Notification.DEFAULT_SOUND; //默认声音
notificationManager.notify(0, notification);//发起通知
这样存进去,然后,接收就可以。intent.getIntExtra("height");