SimonSimCity / Xamarin-CrossDownloadManager

A cross platform download manager for Xamarin
MIT License
149 stars 68 forks source link

Cancel Download; Show common progress; Image #87

Closed AndreiMisiukevich closed 6 years ago

AndreiMisiukevich commented 6 years ago

Hi I've got several questions 1) How can user cancel downloading 2) Is it possible to show common progress line (percentage). Because now it shows progress for each downloading item 3) Is it possible to set up custom image for notification

Thank you)

SimonSimCity commented 6 years ago
  1. See the sample I've posted. A second click on the button cancels the download. For some reason I implemented it on each platform separately ... foo is an instance of IDownloadFile: https://github.com/SimonSimCity/Xamarin-CrossDownloadManager/blob/4ad9ca596911ef69e12c371e670b281b71cbd562/Sample/Droid/MainActivity.cs#L66-L70 https://github.com/SimonSimCity/Xamarin-CrossDownloadManager/blob/4ad9ca596911ef69e12c371e670b281b71cbd562/Sample/iOS/ViewController.cs#L35-L39
  2. This is just a calculation you have to do yourself. Android (as far as I remember) does not store any information about which app downloaded the file, so you can actually also find downloads of GooglePlay, just happens to update an app. On iOS you'll get the downloads of everyone having the same bundle identifier which must be unique and registered before uploading your app to the app store. Is UWP relevant to you?
  3. You're asking this for Android, right? You can either remove the notification as you can see here: https://github.com/SimonSimCity/Xamarin-CrossDownloadManager/blob/4ad9ca596911ef69e12c371e670b281b71cbd562/Sample/Droid/MainActivity.cs#L25-L26 and create your own or you can wait until someone picks up https://github.com/SimonSimCity/Xamarin-CrossDownloadManager/issues/34.

Does this answer all questions?

AndreiMisiukevich commented 6 years ago

Thanks for quick response. 1) I meant canceling downloading from Notification (But I understood, that it requires #34) 2) #34 3) #34

Yes, it's clear. I need to customize notification

SimonSimCity commented 6 years ago

Ok, let's continue on 1. a bit more. Which version of Android do you use? I guess we're only talking about Android here, right?

According to this post (https://www.androidpolice.com/2016/03/21/android-n-feature-spotlight-the-download-managers-notification-gets-a-quickly-accessible-cancel-button/) it should be possible to do it natively from Android Nougat on.

In addition I found this bug report: https://stackoverflow.com/questions/39231544/downloadmanager-and-android-7-0-cancel-feature

Could you please verify if it works from Android Nougat onwards?

AndreiMisiukevich commented 6 years ago

Yes, only about Android. I tested it on Android 5.1

It's rather old) So, this feature is available starting 7.0, isn't it? For old versions I should implement custom notification?

SimonSimCity commented 6 years ago

Yes, Android implemented it natively from Android 7.0 on. If you want to have it on earlier versions you'd have to implement a custom notification.

If you test this again with Android 7.0 or higher and you discover that it e.g. doesn't cancel the download properly please raise a new issue.

I'm closing this as a custom notification for 1. would be out of scope of this package.