1
我正在使用一個AsyncTask,它下載一個apk文件,然後以後執行方法安裝它。Android存儲多個通知ID並允許同時顯示多個通知
預執行 {
Get a notification variable from shared preference and adds +1 to it
Create a new notification based on this variable
}
做背景 {
Update this notification based on its ID -1 (to refer to initial notification ID)
}
後執行 {
Update this notification based on its ID -1 (to refer to initial notification ID)
}
同時該線程運行時(例如下載網絡上非常大的文件),我將允許用戶啓動另一個下載時。在這種情況下,我想顯示2個通知,而不是重複使用相同的通知ID。當我在後臺執行和後臺執行線程中引用其通知ID時,具有兩個唯一通知ID的最佳方式是什麼?謝謝