- nm = (NotificationM
- nm = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
- Notification notification = new Notification(android.R.drawable.stat_sys_download, itemname, System
- .currentTimeMillis());
- Intent notificationIntent = new Intent(context, InstallActivity. class );
- notificationIntent.putExtra("hasdownloaded" , false );
- notificationIntent.putExtra("oranotificationid" , oranotificationid);
- PendingIntent contentIntent = PendingIntent.getActivity(context,
- this .oranotificationid,
- notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
- // notification.contentIntent = contentIntent;
- notification.setLatestEventInfo(context, null , null ,
- contentIntent);
- notification.contentView = new RemoteViews(context.getPackageName(),
- R.layout.imediadotbiz_process);
- notification.contentView.setTextViewText(R.id.dotbizimedia_core_tv_downing, itemname);
- notification.contentView.setProgressBar(R.id.dotbizimedia_core_pb_downing, 100 , 0 , false );
- nm.notify(oranotificationid, notification);
启动多个notification后,设置每个notification对应的事件,注意“
- PendingIntent contentIntent = PendingIntent.getActivity(context,
- this .oranotificationid,
- notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
第二个参数必须唯一,否则notification点击事件会被后边的notification覆盖,以致只有最后产生的notification有点击事件
notification机制有空得好好研究下,待续
发表评论
表情图标
- Notification notification = new Notification(android.R.drawable.stat_sys_download, itemname, System
- .currentTimeMillis());
- Intent notificationIntent = new Intent(context, InstallActivity. class );
- notificationIntent.putExtra("hasdownloaded" , false );
- notificationIntent.putExtra("oranotificationid" , oranotificationid);
- PendingIntent contentIntent = PendingIntent.getActivity(context,
- this .oranotificationid,
- notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
- // notification.contentIntent = contentIntent;
- notification.setLatestEventInfo(context, null , null ,
- contentIntent);
- notification.contentView = new RemoteViews(context.getPackageName(),
- R.layout.imediadotbiz_process);
- notification.contentView.setTextViewText(R.id.dotbizimedia_core_tv_downing, itemname);
- notification.contentView.setProgressBar(R.id.dotbizimedia_core_pb_downing, 100 , 0 , false );
- nm.notify(oranotificationid, notification);
启动多个notification后,设置每个notification对应的事件,注意“
- PendingIntent contentIntent = PendingIntent.getActivity(context,
- this .oranotificationid,
- notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
第二个参数必须唯一,否则notification点击事件会被后边的notification覆盖,以致只有最后产生的notification有点击事件
notification机制有空得好好研究下,待续
评论
发表评论
表情图标
![](https://i-blog.csdnimg.cn/blog_migrate/fdae2ee6389663d0e8e8cedf36783999.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/4762a8ec9eb60433747467059e99f95e.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/70e6f45409acf447b2fa7efdb0a3e40d.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/0bb8607afda370c63b5554b6e8885ffd.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/395f56c5980fbb3e31f1ec85cb557b9e.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/4dcbb665af73b7d0cf235c3bf4436f90.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/e62600a0b5762b94396c35c27b2adda8.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/d452feb9f9bd26ce6184b2f5623f1534.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/af6d31ea11d11d9ab3266033918d6c46.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/0fdad3ca8964cd28ec8625ec3ccd4cfb.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/f0148983d7112d60e2c6749bfa31e8e6.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/a038f8d127ac958f0fc9162c1828d461.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/48463b748ef69aacec3dc9cc457c7d87.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/bdd2d55736d2015fe49de71c9e3202fe.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/4549eaaee5401b5a90f205c2b76a7e1f.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/27adcb58c659b2eb3007508809b3ce32.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/5a8c29aae2babf927bb7b1b173be274d.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/3c1dd00b897b54388a49dea885d8a014.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/e764c68af0f4115017332777a9af276c.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6fbac1a3fbe39ee7868ad025050f1598.gif)
评论