Closed abcfy2 closed 5 years ago
After using file opener2 to open a apk file to upgrade self, should see apk installed successfully page.
When I click install button, it crashed.
Android 8.0+
Any
cordova info
cordova-lib@9.0.1 with: cordova-common@3.1.0 cordova-create@2.0.0 cordova-fetch@2.0.1 cordova-serve@3.0.0 Environment: OS: win32 Node: v10.16.0 npm: 6.9.0 Plugins: cordova-plugin-advanced-http cordova-plugin-android-permissions cordova-plugin-app-version cordova-plugin-appavailability cordova-plugin-device cordova-plugin-file cordova-plugin-file-opener2 cordova-plugin-file-transfer cordova-plugin-inappbrowser cordova-plugin-ionic-keyboard cordova-plugin-ionic-webview cordova-plugin-qrscanner cordova-plugin-screen-orientation cordova-plugin-splashscreen cordova-plugin-statusbar cordova-plugin-whitelist es6-promise-plugin
cordova plugin version | grep cordova-plugin-file-opener2
Here is the output:
cordova-plugin-file-opener2 2.2.0 "File Opener2"
async installApp(apk){ this.fileOpener.open(apk, 'application/vnd.android.package-archive').then(() => { }).catch(async e => { this.toast.show('Upgrade failed', 'middle'); }); }
Related issue: https://github.com/pwlin/cordova-plugin-file-opener2/issues/245#issuecomment-497772945
And I find add Intent.FLAG_ACTIVITY_NEW_TASK to FileOpen2.java could solve this issue.
Intent.FLAG_ACTIVITY_NEW_TASK
FileOpen2.java
Expected Behaviour
After using file opener2 to open a apk file to upgrade self, should see apk installed successfully page.
Actual Behaviour
When I click install button, it crashed.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Android 8.0+
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
Any
Cordova CLI info
Plugin version
Here is the output:
Sample Code that illustrates the problem