I download apk file from my server and get the native path after it downloaded and saved on the app dir
then i try to open it with FileOpener but get this error:
EXCEPTION: Uncaught (in promise): Failed to find configured root that contains /data/data/com.ionicframework.power10fs142463/files/Power10_FS_0.2.apk
code:
fileTransfer.download(url, savePath).then((entry) => {
const nativePath = entry.toURL();
FileOpener.open(
nativePath,
'application/vnd.android.package-archive'
);
});
Did any get solution? Even I have same issue.
Yes this solves by changing the save path from “File.dataDirectory” to > File.externalDataDirectory.
Example code:
const savePath = File.externalDataDirectory + '/newVersions/' + 'AppName_' + this.newVersionNumber.toString() + '.apk';
fileTransfer.download(url, savePath).then((entry) => {
const nativePath = entry.toURL();
FileOpener.open(
nativePath,
'application/vnd.android.package-archive'
).then((success) => {
console.log('success: ', success);
}, (err) => {
console.log('err: ', err);
});
}
3 Likes
Thank you @avishai_peretz_dev for you code.
But when the device have not a SD Card, your code run ?
Thank You in advance. 
sure its not go to sd card
this give me popup of “There was a problem while parsing the pakage”
@avishai_peretz_dev Thanks its working, it saved a lot of time.