当前位置: 代码迷 >> Android >> 怎么在Service中写notification
  详细解决方案

怎么在Service中写notification

热度:92   发布时间:2016-05-01 22:06:00.0
如何在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……
  相关解决方案