Cordova webintent limitation

344 Views Asked by At

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?

0

There are 0 best solutions below