Search code examples
androidnotificationmanager

Android NotificationManager issue


I'm using the download file from url from this link http://www.worldbestlearningcenter.com/tips/Android-download-notification.htm and everything was working fine till I tried to download a new file while one is still download, the new one didn't show... is there anyways I can make different NotificationManager for each new download? And how can I also add Pause and resume to it

Thanks


Solution

  • For two download task you use the same notification number in twice

    mNotifyManager.notify(0, mBuilder.build());
    

    Change to

    mNotifyManager.notify(notificationnr, mBuilder.build());
    

    Add a constructor to BackTask to give every task it's own identification number.

    There are more strange things with the code. For instance the Toast in onPreExecute() displays much to late. And if you place a toast in onPostExecute too and use two tasks you will only see the first toast from OnPreExecute and the last one from onPostExecute. Lett all toasts display de indentification number too so you can distinghuish them.

    The notifications do not disappear when clicked. This is not normal behaviour.