import { Downloader, DownloadRequest, NotificationVisibility } from ‘@ionic-native/downloader/ngx’;
const url = this.violationVideosPath + this.violation_video;
var request: DownloadRequest = {
uri: url,
title: ‘MyDownload’,
description: ‘’,
mimeType: ‘’,
visibleInDownloadsUi: true,
notificationVisibility: NotificationVisibility.VisibleNotifyCompleted,
destinationInExternalFilesDir: {
dirType: ‘Downloads’,
subPath: ‘MyFile.mp4’
}
};
this.downloader.download(request)
.then((location: string) => {
console.log('File downloaded at:' + location)
this.toastService.showSuccess("Video downloaded successfully","success")
})
.catch((error: any) => {
console.error(error)
}
);
i am using this plugin to download the file in mobile here I am getting this path “file:///storage/emulated/0/Android/data/io.vms.app/files/Downloads/MyFile.mp4”
but I am not able to see this path in my mobile app, it is not creating any path in mobile,
can any one please help me with this and here I need to use only cordova plugin
Thank you
First off, @ionic-native
is dead and was migrated over to awesome-cordova-plugins
back in 2021. See A New Chapter for @ionic-native - Ionic Blog.
I don’t see the downloader
plugin in the awesome-cordova-plugin
repo so it’s most likely not a viable option any more.
The plugin uses GitHub - Luka313/integrator-cordova-plugin-downloader: Cordova android plugin for downloading files via DownloadManager which hasn’t been updated for 5 years so my guess is that it no longer supports the latest version of Android.
1 Like
I am also facing the same issue in ‘downloader’ while upgrading to Ionic 7. So, what can I do for this? Are there any alternations ?
I have created a merge request (waiting to be merged) to wrap this downloader cordova plugin into @awesome-cordova-plugin/downloader .
I have also created a forked version of integrator-cordova-plugin-downloader
: @e-is/cordova-plugin-downloader
, which includes some fixes a permission error an Android API 33. The new @awesome-cordova-plugin/downloader
(if approved) will be compatible with both cordova plugins (the old one integrator-cordova-plugin-downloader
and the new @e-is/cordova-plugin-downloader
)
While waiting for the MR to be approved, I use this configuration in my package.json
:
"dependencies": {
"@ionic-native/core": "^5.36.0",
"@ionic-native/downloader": "^5.36.0"
// Forked from `integrator-cordova-plugin-downloader` and well-maintained (compatible with Android API 33+)
"@e-is/cordova-plugin-downloader": "^1.2.0"
}
This works with Ionic 7+:
- if you force the installation of the dependencies using
npm install --force
due to an incompatibility issue with the rxjs
version,
- and even if you are using plugins from awesome-cordova-plugin.