i downloading file device external storage android app web server using downloadmanager
. need initiate function on completion of download. file download code goes this:
string url = "http://192.168.1.105/download/file.ext"; downloadmanager.request request = new downloadmanager.request(uri.parse(url)); request.setdestinationinexternalpublicdir(environment.directory_downloads, "files.ext"); downloadmanager manager = (downloadmanager) getsystemservice(context.download_service); final long downloadid = manager.enqueue(request);
please suggest how ondownloadcomplete
.....
you can use action_download_complete broadcastreceiver
public class donwloadcompletereceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { // complete download id long completedownloadid = intent.getlongextra(downloadmanager.extra_download_id, -1); // here } }
Comments
Post a Comment