How download a file from external url using ionic2?

i need to download file from external url like “htttp://” on my button click please any one help me to do this functionality in my app .i am eagerly waiting for your reply friends

use file transfer plugin

1 Like

Any reference link please

thank you i try this and let you know

i have tried this its working but how to know download start

Try LoadingController , when your download is beginning a loader will be showed in your view after the download is ok the loader will be hidden and you can start any function :

add import { LoadingController } from 'ionic-angular';

add loader:any;

add `public loadingCtrl: LoadingController to constructor

in your constructor or any function you can create a loader :

this.loader = this.loadingCtrl.create({
      content: "Wait download ..",

before code of download present your loader :

after code hide loader :

on android 6,0.1 i am getting error for any think i need to add it in config.xml?

upgrade your cordova plugin to Cordova Android 6.2.3 or Cordova Android 6.2.2

<engine name="android" spec="^6.2.3" />   
 <plugin name="cordova-plugin-console" spec="^1.0.5" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-file-transfer" spec="^1.6.3" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />

this is in config.xml

No , juste look here How to update cordova and ionic?

Is there really a compelling reason to use a Cordova plugin here instead of just good old Angular Http?

i am not understood what your saying here

I am saying “what is wrong with http.get("url/of/thing.mp3")?”

1 Like

using this download audio files in real device

Isn’t that what you said you wanted to do?