0

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

Agbeniga
  • 9
  • 2
  • you can use Android Download Manager service instead of reinventing a wheel.http://developer.android.com/reference/android/app/DownloadManager.html this handles the resume mechanism at its own. – Kirtan Aug 08 '15 at 04:30
  • @Kirtan. Can NotificationManagers be used with Download Manager? While downloading? I didn't know that. Please show. – greenapps Aug 08 '15 at 07:10

1 Answers1

0

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.

greenapps
  • 11,154
  • 2
  • 16
  • 19
  • thanks greenapps, and also, if I try to minimize the app, the download freezes.. I will love it if you can try and provide a link to any working code like this or just help to fix it. thanks – Agbeniga Aug 08 '15 at 09:07
  • Minimizing an app? Whats that? – greenapps Aug 08 '15 at 09:45