Git Product home page Git Product logo

Comments (17)

hnvn avatar hnvn commented on August 17, 2024 2

I can set the max concurrent download task on iOS side (in fact, I set it 5 now) but I don't see anything like that in WorkManager on Android side. I will bring up this feature when I can deal with Android side

from flutter_downloader.

ramonpaolo avatar ramonpaolo commented on August 17, 2024 1

I have the same problem today

With: flutter_downloader: ^1.7.0+1

from flutter_downloader.

webpn avatar webpn commented on August 17, 2024

I tried using different urls, both on HTTP and on HTTPS, but I get the same error.

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

I can't reproduce your problem. If you don't mind, give me the source code to reproduce it.

from flutter_downloader.

cbenhagen avatar cbenhagen commented on August 17, 2024

I see the same issue when I run the example from this repository:

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
I/FlutterActivityDelegate(12202): onResume setting current activity to this
Syncing files to device Android SDK built for x86...
D/        (12202): HostConnection::get() New Host Connection established 0xe7398880, tid 12223
D/EGL_emulation(12202): eglMakeCurrent: 0xe70833c0: ver 3 0 (tinfo 0xe7383340)
I/flutter (12202): Download task (78e95445-4759-4cfa-ade6-3dea7c66ae32) is in status (DownloadTaskStatus(1)) and process (0)
I/flutter (12202): Download task is enqueued with id(78e95445-4759-4cfa-ade6-3dea7c66ae32)
D/SystemJobScheduler(12202): Scheduling work ID 78e95445-4759-4cfa-ade6-3dea7c66ae32 Job ID 71
D/GreedyScheduler(12202): Starting tracking for 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/SystemJobService(12202): onStartJob for 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/ConstraintTracker(12202): NetworkStateTracker: initial state = [ Connected=true Validated=true Metered=false NotRoaming=true ]
D/NetworkStateTracker(12202): Registering network callback
D/WorkConstraintsTracker(12202): Constraints met for 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/GreedyScheduler(12202): Constraints met: Scheduling work ID 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/WorkConstraintsTracker(12202): Constraints met for 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/GreedyScheduler(12202): Constraints met: Scheduling work ID 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/Processor(12202): Processor: processing 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/Processor(12202): Work 78e95445-4759-4cfa-ade6-3dea7c66ae32 is already enqueued for processing
D/Processor(12202): Work 78e95445-4759-4cfa-ade6-3dea7c66ae32 is already enqueued for processing
D/NetworkStateTracker(12202): Network capabilities changed: [ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&FOREGROUND LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -50]
D/WorkerWrapper(12202): Worker result FAILURE for 78e95445-4759-4cfa-ade6-3dea7c66ae32
D/Processor(12202): Processor 78e95445-4759-4cfa-ade6-3dea7c66ae32 executed; isSuccessful = false, reschedule = false
D/SystemJobService(12202): 78e95445-4759-4cfa-ade6-3dea7c66ae32 executed on JobScheduler

On the beta channel:

[✓] Flutter (Channel beta, v0.4.4, on Mac OS X 10.13.5 17F77, locale de-CH)
    • Flutter version 0.4.4 at /Users/ben/flutter
    • Framework revision f9bb4289e9 (5 weeks ago), 2018-05-11 21:44:54 -0700
    • Engine revision 06afdfe54e
    • Dart version 2.0.0-dev.54.0.flutter-46ab040e58

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/ben/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4, Build version 9F1027a
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 25.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

• No issues found!

And dev:

lutter doctor -v
[✓] Flutter (Channel dev, v0.5.4, on Mac OS X 10.13.5 17F77, locale de-CH)
    • Flutter version 0.5.4 at /Users/ben/flutter
    • Framework revision 3019ad976d (2 days ago), 2018-06-11 11:31:25 -0700
    • Engine revision d33bbff470
    • Dart version 2.0.0-dev.60.0.flutter-a5e41681e5

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/ben/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4, Build version 9F1027a
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 25.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

• No issues found!

from flutter_downloader.

webpn avatar webpn commented on August 17, 2024

Sure, I'll publish my repo soon (probably in next 12 hours): maybe the error is caused by some conflict with other installed packages.

from flutter_downloader.

webpn avatar webpn commented on August 17, 2024

Here it is: https://github.com/webpn/demo_downloader

I just picked the interesting part from my app and placed it into a fresh install of Flutter.

If it could be helpful, this is the output from Flutter Doctor:

[✓] Flutter (Channel beta, v0.4.4, on Mac OS X 10.13.5 17F77, locale it-IT)
    • Flutter version 0.4.4 at ~/dev/flutter
    • Framework revision f9bb4289e9 (5 weeks ago), 2018-05-11 21:44:54 -0700
    • Engine revision 06afdfe54e
    • Dart version 2.0.0-dev.54.0.flutter-46ab040e58

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.0)
    • Android SDK at ~/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.0
    • ANDROID_HOME = ~/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4, Build version 9F1027a
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 25.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

I try your code and it works. btw, what device do you test and Android version?

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

I can reproduce this matter on Android Simulator (running Android 28). I am working on it.

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

There's a problem with WorkManager library (still in alpha), it causes this plugin failure on Android 26 and above. I need to wait for the next version of WorkManager.

from flutter_downloader.

webpn avatar webpn commented on August 17, 2024

I tested that code directly on my phone, which runs on Android 8.0.0 (= API level 26).

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

There's a significant change of background task policy from API 26. I think it causes our problem. I just created an issue for WorkManager, it's a new project of Google, so it would be updated soon.

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

There's a mature library called JobIntentService can address our problem, I think I will consider switching to it

from flutter_downloader.

hnvn avatar hnvn commented on August 17, 2024

I got it worked. It's just my stupid mistake when I config NotificationChannel (not the problem of WorkManager library). I've just published v.0.0.4. Let's check it out.

from flutter_downloader.

webpn avatar webpn commented on August 17, 2024

Yay, it works perfectly!

Feature suggestion: new parameter to specify how many concurrent download should be running.

from flutter_downloader.

Joao-Filh0 avatar Joao-Filh0 commented on August 17, 2024

I have this problem , can you help me ?

java.lang.NullPointerException: uri
W/System.err( 9348): at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:133)
W/System.err( 9348): at android.content.ContentResolver.query(ContentResolver.java:918)
W/System.err( 9348): at android.content.ContentResolver.query(ContentResolver.java:880)
W/System.err( 9348): at android.content.ContentResolver.query(ContentResolver.java:836)
W/System.err( 9348): at vn.hunghd.flutterdownloader.DownloadWorker.getMediaStoreEntryPathApi29(DownloadWorker.java:531)
W/System.err( 9348): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.java:394)
W/System.err( 9348): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.java:235)
W/System.err( 9348): at androidx.work.Worker$1.run(Worker.java:86)
W/System.err( 9348): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err( 9348): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err( 9348): at java.lang.Thread.run(Thread.java:919)
I/WM-WorkerWrapper( 9348): Worker result FAILURE for Work [ id=9b39dcf7-121d-4c59-a740-68496528c170, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]

from flutter_downloader.

ElsayedDev avatar ElsayedDev commented on August 17, 2024

Make sure you added this permissions in AndroidManifest.xml


    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

In main function add FlutterDownloader.registerCallback(DownloadClass.callback); ( it is take static callback )

as mentioned in https://stackoverflow.com/a/72889016/11989529

abstract class DownloadClass {
  static void callback(String id, DownloadTaskStatus status, int progress) {
    debugPrint("Download Status:: $status");
    debugPrint("Download Progress:: $progress");
  }
}

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await FlutterDownloader.initialize(debug: true);

  FlutterDownloader.registerCallback(DownloadClass.callback);

  runApp(const MyApp());
}

from flutter_downloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.