Comments (10)
@Berdsen Please open the file once the download progress is completed.
You can check the status and progress like this
_port.listen((dynamic data) {
final taskId = (data as List)[0] as String;
final status = DownloadTaskStatus.fromInt(data[1] as int);
final progress = data[2] as int;
});
from flutter_downloader.
Ah sorry. I forgot to mention, that the sender just sends the message when the status is completed and the progress is equal to 100. But unfortunately the file doesn't exist in the given path, because the saved filepath in the task entry remains in the application directory (../Android/data/...) but is saved correctly in the Downloads folder
from flutter_downloader.
@Berdsen If you don't want to open the file. Comment this line
FlutterDownloader.open(taskId: id).then((value) => {debugPrint('Open file: $value')});
from flutter_downloader.
@Berdsen Can you please add console log output by setting debug in Initialization.
await FlutterDownloader.initialize(debug: true);
from flutter_downloader.
@balajiks-dev
The debug output I get is the following
I/flutter (13527): ### - onDownloadStart
D/HostConnection(13527): createUnique: call
D/HostConnection(13527): HostConnection::get() New Host Connection established 0xb400007ae95f9f90, tid 13729
D/HostConnection(13527): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma ANDROID_EMU_hwc_multi_configs GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0
D/EGL_emulation(13527): eglMakeCurrent: 0xb400007ae95f9ed0: ver 3 0 (tinfo 0x7cfea70380) (first time)
D/DownloadWorker(13527): DownloadWorker{url=<URL>,filename=null,savedDir=/storage/emulated/0/Android/data/com.example.app/files,header={ /* STRIPPED */ },isResume=false,status=ENQUEUED
D/DownloadWorker(13527): Update notification: {notificationId: 2, title: <URL>, status: RUNNING, progress: 0}
D/DownloadWorker(13527): Open connection to <URL>
D/DownloadWorker(13527): Headers = { /* STRIPPED */ }
D/DownloadWorker(13527): Content-Length = 70150
D/DownloadWorker(13527): Charset = null
D/DownloadWorker(13527): Content-Disposition = attachment; filename=FILENAME.pdf
D/DownloadWorker(13527): fileName = FILENAME.pdf
D/DownloadWorker(13527): Update notification: {notificationId: 2, title: FILENAME.pdf, status: RUNNING, progress: 5}
8 D/DownloadWorker(13527): Update too frequently!!!!, this should be dropped
D/DownloadWorker(13527): Setting an intent to open the file /storage/emulated/0/Download/FILENAME.pdf
D/DownloadWorker(13527): Update too frequently!!!!, but it is the final update, we should sleep a second to ensure the update call can be processed
D/DownloadWorker(13527): Update notification: {notificationId: 2, title: FILENAME.pdf, status: COMPLETE, progress: 100}
D/DownloadWorker(13527): File downloaded
I/flutter (13527): Task: 76385681-c2f2-43e9-b72a-fe37b9a11d0b, status: DownloadTaskStatus.complete, progress: 100
I/WM-WorkerWrapper(13527): Worker result SUCCESS for Work [ id=76385681-c2f2-43e9-b72a-fe37b9a11d0b, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
I/flutter (13527): Open file: true
But in the code part, where the the task is read the follwing savedDir is retrieved from the task
savedDir: "/storage/emulated/0/Android/data/com.example.app/files"
_port.listen((message) {
String id = message[0];
Future.delayed(const Duration(seconds: 1), () {
FlutterDownloader.loadTasksWithRawQuery(query: "SELECT * FROM task WHERE task_id='$id'").then((tasks) {
if (tasks == null || tasks.isEmpty) return;
final task = tasks.first;
final taskId = task.taskId;
final status = task.status;
final progress = task.progress;
debugPrint('Task: $taskId, status: $status, progress: $progress');
FlutterDownloader.open(taskId: id).then((value) => {debugPrint('Open file: $value')});
});
});
});
from flutter_downloader.
@Berdsen See here savedDir=/storage/emulated/0/Android/data/com.example.app/files
Add the file name correctly and once File downloaded. Check the local storage of the file.
from flutter_downloader.
Yes. But when the saveInPublicStorage flag is set, the file doesn't exist as /storage/emulated/0/Android/data/com.example.app/files/FILENAME.pdf
but is stored as /storage/emulated/0/Download/FILENAME.pdf
I could get the filename and rewrite the path, but if the file is downloaded multiple times, the flutter_downloader correctly adds a number like FILENAME (1).pdf
and also this filename isn't populated to the task entry, which has just the start information savedDir and original filename
from flutter_downloader.
@Berdsen Got your point. But I can't reproduce it. If possible, add example project in any public repo and share me the link here please.
from flutter_downloader.
@balajiks-dev
See here the repo
Also check the TODO, where the problem can be seen
from flutter_downloader.
@Berdsen Ok I will check and let you know in this week.
from flutter_downloader.
Related Issues (20)
- problem open loaded task HOT 15
- Getting Error in iOS device HOT 3
- Downloader works for devices of android 13 but not working specifically for Specifically in my device Oppo F21 HOT 1
- Deleting file and download again the same file not working
- Nullpointer exception on httpconn.contentType in DownloadWorker.kt if contentType is not provided by the server. HOT 5
- httpConn.contentType must not be null error when download file HOT 1
- Flutter Download CallBack Not Working At first time HOT 5
- File Download Not working in the example project
- Flutter downloader is not working in Android (Permission denied) HOT 2
- File Name extension got changed while multiple download HOT 1
- 下载进度到达100后又返回错误 HOT 1
- no such column: save_in_public_storage (code 1 SQLITE_ERROR) HOT 1
- Download is getting failed in android when i am saving files in local directory. It is working only when i am giving saveInPhoneStorage:true.
- Downloading not working suddenly say download complete
- Download is Not Working HOT 2
- LoadTasksWithRawQuery not working
- 'failed to set registerPlugins' in integration with flutter module
- Negative progress HOT 3
- In iOS ,i get a sql error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_downloader.