android – Download manager does not downloads files from raspberry pi device to mobile device-ThrowExceptions

Exception or error:

I am working on a app that connects to Raspberry pi device through mobile hot spot and on request it downloads the file from pi device to mobile storage. I have used various methods as suggested on google but no result.currently i am using download manager class , this class works fine on other server like i have tested on local host and web server both but in case of pi server(Apache & CGIHTTP server) it doesn’t downloads file.

DownloadManager downloadmanager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
 Uri Download_Uri = Uri.parse("");

            System.out.println("DashboardActivity getData() onSuccess Download_Uri :"+Download_Uri);

            DownloadManager.Request request = new DownloadManager.Request(Download_Uri);
            request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);
            request.setTitle("U4U Downloading " + "Sample" + ".jpg");
            request.setDescription("Downloading " + "Sample" + ".jpg");
            request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "/test/"  + "/" + "Sample" + ".jpg");

            System.out.println("DashboardActivity getData() onSuccess request :"+request);

            refid = String.valueOf(downloadmanager.enqueue(request));

            System.out.println("DashboardActivity getData() onSuccess refid :"+refid);
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *