Skip to content

Commit af49160

Browse files
authored
Merge pull request #406 from zrina1314/master
Update usage document
2 parents 79a9bb6 + 69d8376 commit af49160

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,22 @@ This is a new feature added in `0.9.0` if you're going to open a file path using
631631

632632
Download and install an APK programmatically
633633

634+
Note:
635+
be sure to specify the path, do not use the default path, because the permission problem causes the installation to fail, parsing the package fails
636+
637+
default path: `/data/data/com.android.providers.downloads/cache/xxx.apk` // Will cause parsing of the package to fail,Unable to install APK
638+
634639
```js
635640

636641
const android = ReactNativeBlobUtil.android
642+
const dirs = ReactNativeBlobUtil.fs.dirs;
643+
const apkUrl = "http://www.example.com/awesome.apk";
644+
const fileName = url.substring(url.lastIndexOf('/') + 1);
637645

638646
ReactNativeBlobUtil.config({
639647
addAndroidDownloads: {
640648
useDownloadManager: true,
649+
path: `${dirs.DownloadDir}/${fileName}`, // <-- Must specify
641650
title: 'awesome.apk',
642651
description: 'An APK that will be installed',
643652
mime: 'application/vnd.android.package-archive',

0 commit comments

Comments
 (0)