SHARE
TWEET

Untitled

a guest Jun 27th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. D/permissions_handler(16054): No permissions found in manifest for: $permission
  2. D/permissions_handler(16054): No permissions found in manifest for: $permission
  3. I/flutter (16054): decodePermissionRequestResult called with: value:[{14: 4}]
  4. W/WM-WorkSpec(16054): Backoff delay duration less than minimum value
  5. E/MethodChannel#vn.hunghd/downloader(16054): Failed to handle method call
  6. E/MethodChannel#vn.hunghd/downloader(16054): java.lang.IllegalStateException: WorkManager is not initialized properly.  The most likely cause is that you disabled WorkManagerInitializer in your manifest but forgot to call WorkManager#initialize in your Application#onCreate or a ContentProvider.
  7. E/MethodChannel#vn.hunghd/downloader(16054):    at androidx.work.WorkManager.getInstance(WorkManager.java:141)
  8. E/MethodChannel#vn.hunghd/downloader(16054):    at vn.hunghd.flutterdownloader.FlutterDownloaderPlugin.enqueue(FlutterDownloaderPlugin.java:175)
  9. E/MethodChannel#vn.hunghd/downloader(16054):    at vn.hunghd.flutterdownloader.FlutterDownloaderPlugin.onMethodCall(FlutterDownloaderPlugin.java:73)
  10. E/MethodChannel#vn.hunghd/downloader(16054):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
  11. E/MethodChannel#vn.hunghd/downloader(16054):    at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188)
  12. E/MethodChannel#vn.hunghd/downloader(16054):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
  13. E/MethodChannel#vn.hunghd/downloader(16054):    at android.os.MessageQueue.nativePollOnce(Native Method)
  14. E/MethodChannel#vn.hunghd/downloader(16054):    at android.os.MessageQueue.next(MessageQueue.java:326)
  15. E/MethodChannel#vn.hunghd/downloader(16054):    at android.os.Looper.loop(Looper.java:160)
  16. E/MethodChannel#vn.hunghd/downloader(16054):    at android.app.ActivityThread.main(ActivityThread.java:6669)
  17. E/MethodChannel#vn.hunghd/downloader(16054):    at java.lang.reflect.Method.invoke(Native Method)
  18. E/MethodChannel#vn.hunghd/downloader(16054):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  19. E/MethodChannel#vn.hunghd/downloader(16054):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
  20. I/flutter (16054): Download task is failed with reason(WorkManager is not initialized properly.  The most likely cause is that you disabled WorkManagerInitializer in your manifest but forgot to call WorkManager#initialize in your Application#onCreate or a ContentProvider.)
  21. W/5gmail.playlis(16054): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (light greylist, linking)
  22.      
  23. import 'package:flutter_downloader/flutter_downloader.dart';
  24. import 'package:path_provider/path_provider.dart';
  25. import 'package:permission_handler/permission_handler.dart';
  26.  
  27. class DownloadManager {
  28.   Future<bool> checkPermission() async {
  29.     PermissionStatus permission = await PermissionHandler()
  30.         .checkPermissionStatus(PermissionGroup.storage);
  31.     if (permission != PermissionStatus.granted) {
  32.       Map<PermissionGroup, PermissionStatus> permissions =
  33.       await PermissionHandler()
  34.           .requestPermissions([PermissionGroup.storage]);
  35.       if (permissions[PermissionGroup.storage] == PermissionStatus.granted) {
  36.         return true;
  37.       }
  38.     }
  39.     return false;
  40.   }
  41.  
  42.   void inti(String url) async {
  43.     await checkPermission();
  44.     final directory = await getExternalStorageDirectory();
  45.     final taskId = await FlutterDownloader.enqueue(
  46.       url: url,
  47.       savedDir: directory.toString(),
  48.       showNotification: true, // show download progress in status bar (for Android)
  49.       openFileFromNotification: true, // click on notification to open downloaded file (for Android)
  50.     );
  51.     FlutterDownloader.registerCallback((id, status,progress) {
  52.       print(
  53.           'Download task ($id) is in status ($status) and process ($progress)');
  54.     });
  55.   }
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top