1

i am using cordova webintent in my project for updating internally. which is working fine with android 6.

I have this new device which is in android 9 and when i try to update my app it says Failed to open android intent.

I have been searching the net if theres a limitation of cordova plugin webintent with regards to android version but i cannot any issues.

Below is my code downloading and calling my apk file to start installation. Again this is working with android version 6.

var fileURL = cordova.file.externalDataDirectory + 'lg.apk';
                    var fileTransfer = new FileTransfer();
                    var uri = encodeURI(API_URL+"debug.apk?v="+AppVersion.version);
                    var errorCodes = {
                        '1' : 'FileTransferError.FILE_NOT_FOUND_ERR',
                        '2' : 'FileTransferError.INVALID_URL_ERR',
                        '3' : 'FileTransferError.CONNECTION_ERR',
                        '4' : 'FileTransferError.ABORT_ERR',
                        '5' : 'FileTransferError.NOT_MODIFIED_ERR'
                    }
fileTransfer.download(
                        uri,
                        fileURL,
                        function (entry) {
                            //promptForUpdateAndroid(entry);
                            /** **/
                            $rootScope.updatingApp = false;
                            $rootScope.loading = false;
                            func.logout();
                            $rootScope.$apply();
                            window.plugins.webintent.startActivity({
                                action: window.plugins.webintent.ACTION_VIEW,
                                url: entry.toURL(),
                                type: 'application/vnd.android.package-archive'
                            },
                            function () {
                                $rootScope.updatingApp = false;
                                $rootScope.$apply();
                            },
                            function () {
                                $rootScope.updatingApp = false;
                                $rootScope.$apply();
                                alert('Failed to open URL via Android Intent.');
                                console.log(entry,entry.toURL());
                                console.log("Failed to open URL via Android Intent. URL: " + entry.fullPath);
                            }); 
                        },

Is there any limitation which is currently not supported yet by the plugin?

  • Do you get any other errors when deploying the app with Android Studio? – JM-AGMS Apr 18 '19 at 16:46
  • @JM-AGMS I am using only cordova command line in order to build the app. i dont get any errors. in-app update works properly in android 6 but on android 9 it doesnt. I am very confused why Android intent fails. – John Christian De Chavez Apr 22 '19 at 06:04

0 Answers0