Using Android DownloadManager,how do i get file name?

Using Android DownloadManager,how do i get file name?

By : Nuno Edgar Fernandes
Date : November 29 2020, 09:01 AM
will help you I'm using DownloadManager class to manage downloads, i'm using this , You can use:
code :

Share : facebook icon twitter icon
Android DownloadManager API - opening file after download?

Android DownloadManager API - opening file after download?

By : The Question
Date : March 29 2020, 07:55 AM
like below fixes the issue I am facing problem of opening downloaded file after successfull download via DownloadManager API. In my code: , You need to register a reciever for when the download is complete:
code :
registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
BroadcastReceiver onComplete=new BroadcastReceiver() {
    public void onReceive(Context ctxt, Intent intent) {
        // Do Something
protected void openFile(String fileName) {
    Intent install = new Intent(Intent.ACTION_VIEW);
    install.setDataAndType(Uri.fromFile(new File(fileName)),
Android DownloadManager doesn't save file

Android DownloadManager doesn't save file

By : Snigdh Chandra
Date : March 29 2020, 07:55 AM
Does that help After some more work on this, I found the problem: it seems android's DownloadManager needs the Content-Length header present on the response, something I wasn't sending for my generated files.
Get file name from headers with DownloadManager in Android

Get file name from headers with DownloadManager in Android

By : Ke Xu
Date : March 29 2020, 07:55 AM
it fixes the issue In case anyone want an implementation of doing a HEAD request to get the filename:
code :
class GetFileName extends AsyncTask<String, Integer, String>
    protected String doInBackground(String... urls)
        URL url;
        String filename = null;
        try {
            url = new URL(urls[0]);
            String cookie = CookieManager.getInstance().getCookie(urls[0]);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestProperty("Cookie", cookie);

            String content = con.getHeaderField("Content-Disposition");
            String contentSplit[] = content.split("filename=");
            filename = contentSplit[1].replace("filename=", "").replace("\"", "").trim();
        } catch (MalformedURLException e1) {
        } catch (IOException e) {
        return filename;

    protected void onPreExecute() {
    protected void onPostExecute(String result) {

file is not downloading via DownloadManager in Android

file is not downloading via DownloadManager in Android

By : user2170243
Date : March 29 2020, 07:55 AM
will be helpful for those in need Hi i want to download video file and below is my code , Finally Try and error, I found this solution,
code :
    File direct = new File(Constant.FOLDER_PATH);
      uRl = "http://songs7.funmaza.in/videos/Issey Kehte Hain Hip Hop 720p - Yo Yo Honey Singh [Funmaza.com].wmv";
      uRl = uRl.replace(" ", "%20");
      uRl = uRl.replace("[", "%5B");
      uRl = uRl.replace("]", "%5D");
      System.out.println("URL For Download == " + uRl);
      if (!direct.exists()) {
      DownloadManager downloadManager = (DownloadManager) ((Activity) context)
      DownloadManager.Request request = new DownloadManager.Request(
          | DownloadManager.Request.NETWORK_MOBILE)
        .setDescription("Downloading via Your app name..")
        .setTitle("Issey Kehte Hain Hip Hop")
Android DownloadManager not know where the file downloads

Android DownloadManager not know where the file downloads

By : user3547043
Date : March 29 2020, 07:55 AM
I hope this helps you . After two days of tests we were able to partially work. , Use this
code :
request.setDestinationInExternalPublicDir("/updates", "update.apk");
public DownloadManager.Request setDestinationInExternalPublicDir (String dirType, String subPath)
String updatePath = Environment.getExternalStorageDirectory() + File.separator + "Updates" + File.separator + "update.apk";
request.setDestinationUri(Uri.fromFile(new File(updatePath)))
Related Posts Related Posts :
  • Save and Retrieve location inside JPEG image
  • Intent share is not able to attach image
  • Search specific nearby places using google places api web services for android
  • How to update app?
  • Is It possible to develop app with react native and make changes in android studio?
  • How to create Motion Splash Screen in Android?
  • Build Gradle Android studio Build Slow
  • Android - How to Load More then 20mb Image in Imageview
  • Notification is not cancelled after calling notification.cancel
  • How to implement the smart-crop feature
  • Null Pointer exception on reading SMS stored in SIM in Android
  • remove google text from google maps in android
  • Image captured from camera not displaying in imageview android
  • kivy: My screenmanager code is not working with scrollview
  • Dynamic MpAndroidChart Not Working
  • Yandex Maps return 403 Forbidden using retrofit
  • how set selected spinner item in android studio?
  • Does Picasso library for Android handle image loading while network connectivity is off?
  • colorAccent in Holo Theme
  • Android: animation on layout after button clicked for minimum SDK version of 14
  • Are static variable truly "global" (system-wide) in Android?
  • How to create android snackbar with custom layout
  • Animate a car(Marker) along a path in google map android
  • Default to "compass" (gyroscope) mode when viewing a photosphere
  • Gradle - finished with non-zero exit value 1
  • Android Studio 2.0 Application crash on unmodified Application class
  • Android Studio cursor display error
  • Creating Dagger 2 component to be shared between src/test and src/androidTest
  • Android losing state when screen is OFF and ON again
  • Android Notification.Builder addAction PendingIntent Fragment
  • Use another button instead of back button
  • Android Studio Send string over socket after taking a picture [Google Glass]
  • Realm `access from incorrect thread` error when using shared code between IntentService and AsyncTask (Android)
  • osmdroid plotting current location offline
  • GifAnimationDrawable(Gif file) not playing in ListView
  • Controlling emission of Observable items in unit tests
  • android: Log in Button
  • Gradle github and facebook dependencies can't resolve
  • How can you animate a view back and forth between two states on Android, while supporting backpressure?
  • $(LOCAL_PATH) not returning the path to current directory correctly
  • Error:Cause: com.android.sdklib.repository.FullRevision
  • How to get an offset in RecyclerView ItemDecorator
  • Android toolbar home button not showing
  • TextView keeps popping up
  • Toolbar overlaps below status bar
  • Inflated view not updating
  • Errors of the Manifest
  • How to perform the same operation on several elements in array in doInBackground()
  • see error when use getSupportActionBar().setDisplayHomeAsUpEnabled(true)
  • What the heck is going on with this animation?
  • How to set the color of the counter on a TextInputLayout?
  • Cannot resolve symbol 'GeoJsonLayer '
  • Font file not loading on Libgdx Android
  • Simulate GCM push notifications on Android
  • Google maps provider, Wifi, 3g and GPS
  • Textview animation error
  • I want my FAB to stay at the bottom of the screen
  • How to attach multiple Images with a note taking app in android?
  • How to share xml layout using Intent.ACTION_SEND
  • Is there a default selector for the RecyclerView
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co