突然明白了,messenger可以理解為handler再封裝了一層,把這個引用發(fā)給service這樣就可以實現(xiàn)雙向通信了
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){
//獲取通知系統(tǒng)服務(wù)
mNotificaitionManager =(NotificationManager) context.getSystemService(context.NOTIFICATION_MANAGER);
//創(chuàng)建通知的集合
mNotifications = new HashMap<Integer, Notification>();
)
//獲取通知系統(tǒng)服務(wù)
mNotificaitionManager =(NotificationManager) context.getSystemService(context.NOTIFICATION_MANAGER);
//創(chuàng)建通知的集合
mNotifications = new HashMap<Integer, Notification>();
)
2016-04-29