突然明白了,messenger可以理解为handler再封装了一层,把这个引用发给service这样就可以实现双向通信了
2016-05-13
讲师回答 / XRay_Chen
这个问题问得非常好,为了演示handler,注释了原来的onStartCommand方法,把注释去掉保留原来的onStartCommand就可以了!!
2016-05-05
public void showNotification(FileInfo fileInfo){
if(!mNotifications.containsKey(fileInfo.getId())){
Notification notification = new Notification();
notification.tickerText = fileInfo.getName()+"开始下载";
notification.when = System.currentTimeMillis();
}
}
if(!mNotifications.containsKey(fileInfo.getId())){
Notification notification = new Notification();
notification.tickerText = fileInfo.getName()+"开始下载";
notification.when = System.currentTimeMillis();
}
}
2016-04-29
public NotificationUtil(Context context){
//获取通知系统服务
mNotificaitionManager =(NotificationManager) context.getSystemService(context.NOTIFICATION_MANAGER);
//创建通知的集合
mNotifications = new HashMap<Integer, Notification>();
)
//获取通知系统服务
mNotificaitionManager =(NotificationManager) context.getSystemService(context.NOTIFICATION_MANAGER);
//创建通知的集合
mNotifications = new HashMap<Integer, Notification>();
)
2016-04-29