浏览代码

Update README.md

wkh237 8 年前
父节点
当前提交
8fc98d0bce
共有 1 个文件被更改,包括 29 次插入5 次删除
  1. 29
    5
      README.md

+ 29
- 5
README.md 查看文件

@@ -24,7 +24,7 @@ This update is `backward-compatible` generally you don't have to change existing
24 24
  * [Upload file](#user-content-upload-example--dropbox-files-upload-api)
25 25
  * [Multipart/form upload](#user-content-multipartform-data-example--post-form-data-with-file-and-data)
26 26
  * [Upload/Download progress](#user-content-uploaaddownload-progress)
27
- * [Android Media Scanner, and Downloads App Support](#user-content-android-media-scanner-and-downloads-app-support)
27
+ * [Android Media Scanner, and Download Manager Support](#user-content-android-media-scanner-and-downloads-app-support)
28 28
  * [File access](#user-content-file-access)
29 29
  * [File stream](#user-content-file-stream)
30 30
  * [Manage cached files](#user-content-manage-cached-files)
@@ -303,14 +303,17 @@ In `version >= 0.4.2` it is possible to know the upload/download progress.
303 303
     })
304 304
 ```
305 305
 
306
-#### Android Media Scanner, and Downloads App Support
306
+#### Android Media Scanner, and Download Manager Support
307 307
 
308
-If you want to make a file in `External Storage` becomes visible in Picture, Misuc, or other built-in apps, you will have to use `Media Scanner`. To make this happend, use `scanFile` method in `fs`.
308
+If you want to make a file in `External Storage` becomes visible in Picture, Downloads, or other built-in apps, you will have to use `Media Scanner` or `Download Manager`. 
309 309
 
310
+**Media Scanner**
311
+
312
+Media scanner scan the file and categorize by given MIME type, if MIME type not specified, it will try to resolve the file using its file extension.
310 313
 
311 314
 ```js
312 315
 
313
-RNFetchBlog
316
+RNFetchBlob
314 317
     .config({
315 318
         // DCIMDir is in external storage
316 319
         path : dirs.DCIMDir + '/music.mp3'
@@ -325,7 +328,28 @@ RNFetchBlog
325 328
     })
326 329
 ```
327 330
 
328
-If mime is null or undefined, then the mime type will be inferred from the file extension.
331
+**Download Manager**
332
+
333
+When download large files on Android it is recommended to use `Download Manager`, it supports lot of native features like progress bar, and notification, also the download task will be handled by OS, and more effective.
334
+
335
+```js
336
+RNFetchBlob
337
+    .config({
338
+        // Optional, if not specified, the file will download to system default path
339
+        path : DOWNLOAD_DEST, 
340
+        addAdnroidDownloads : {
341
+            useDownloadManager : true, // <-- this is the only thing required
342
+            // Optional, override notification setting (default to true)
343
+            notification : false,
344
+            // Optional, but recommended since android DownloadManager will fail when 
345
+            // the url does not contains a file extension, by default the mime type will be text/plain
346
+            mime : 'text/plain',
347
+            description : 'File downloaded by download manager.'
348
+        }
349
+    })
350
+    .fetch('GET', 'http://example.com/file/somefile')
351
+```
352
+
329 353
 
330 354
 **Download Notification and Visibiliy in Download App (Android Only)**
331 355