joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 772 forks source link

Upgrade apk there was a problem parsing the package #675

Closed xyw1229 closed 3 years ago

xyw1229 commented 3 years ago

rn-fetch-blob@^0.12.0

const Update = () => { const android = RNFetchBlob.android; //配置手机系统通知栏下载文件通知,下载成功后点击通知可运行apk文件 RNFetchBlob.config({ addAndroidDownloads: { useDownloadManager: true, title: 'XX', description: 'XXX', mime: 'application/vnd.android.package-archive', path: ${RNFetchBlob.fs.dirs.DownloadDir}/XXX.apk, mediaScannable: true, notification: true } }).fetch('GET', UPDATEURL //apk url ).progress((received, total) => { // todo:貌似下载进度无法响应 alert(received); console.log('下载进度:' + Math.floor((received / total) * 100) + '%'); }).then(res => { android.actionViewIntent( res.path(), 'application/vnd.android.package-archive' ); }); }

I have ask for permisson of storage. after finish downing the apk, it will appear 'There was a problem parsing the package'. But when i tap the notification on downloadManager, it will work rightly, and install the apk successfully.

xyw1229 commented 3 years ago

add requestLegacyExternalStorage will be ok