首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

怎么在Service中写notification

2012-03-24 
如何在Service中写notification通过Service下载文件,然后想写个notification提示下载完成。。。哪位高手给出

如何在Service中写notification
通过Service下载文件,然后想写个notification提示下载完成。。。哪位高手给出示例代码啊!!!!

[解决办法]
registerNotificationManager = (NotificationManager)IMConnectionService.this.getSystemService(NOTIFICATION_SERVICE);
registerNotification = new Notification ();
registerNotification.tickerText = "提示标题";
registerNotification.icon = R.drawable.main_logo;
registerNotification.when = System.currentTimeMillis();
PendingIntent pt = PendingIntent.getActivity(Service实例, 0, null, 0);
registerNotification.setLatestEventInfo(Service实例, "提示内容", "提示标题", pt);
registerNotificationManager.notify(REGISTER_ID, registerNotification);
[解决办法]
类名.this

探讨

引用:

registerNotificationManager = (NotificationManager)IMConnectionService.this.getSystemService(NOTIFICATION_SERVICE);
registerNotification = new Notification ();
registerNot……

热点排行