突然明白了,messenger可以理解為handler再封裝了一層,把這個(gè)引用發(fā)給service這樣就可以實(shí)現(xiàn)雙向通信了
2016-05-13
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
修改RemoteViews中的控件:
setOnClickPendingIntent(int viewId, PendingIntent pi);
setProgressBar(int viewId, int max, int progress, boolean indeteminate);
//
使用NotificationManager管理通知, notify(int id, Notification notification); cancel(int id)
//
1.修改通知欄中的進(jìn)度條, 重新發(fā)出通知
setOnClickPendingIntent(int viewId, PendingIntent pi);
setProgressBar(int viewId, int max, int progress, boolean indeteminate);
//
使用NotificationManager管理通知, notify(int id, Notification notification); cancel(int id)
//
1.修改通知欄中的進(jìn)度條, 重新發(fā)出通知
2016-04-29
Notification常用屬性:
icon通知圖標(biāo), tickerText通知顯示的文字, when通知時(shí)間, flags通知的特性, contentView通知的視圖, defaults默認(rèn)效果, contentIntent點(diǎn)擊通知欄的操作, sound播放的聲音
icon通知圖標(biāo), tickerText通知顯示的文字, when通知時(shí)間, flags通知的特性, contentView通知的視圖, defaults默認(rèn)效果, contentIntent點(diǎn)擊通知欄的操作, sound播放的聲音
2016-04-29