Adding to Download List Android
Asked Answered
A

1

4

The following function from the class DownloadManager adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

addCompletedDownload(String title, String description,
    boolean isMediaScannerScannable, String mimeType,
    String path, long length, boolean showNotification)

The problem I'm facing is that this function was added in API 12. So I'm looking for an alternative to this function that will work properly for atleast API 10. Thanks in Advance!! :)

There's one more point I forgot to mention that I'm not actually downloading any file.

Abstain answered 15/3, 2013 at 15:49 Comment(10)
i don't understand why your are looking for if you are not downloading anything.Adames
actually i'm transferring a file over wifi, and i want it to be available for Downloads Application. :)Abstain
you could open it with the browser, the browser would put it in the Downloads app (which is part of the browser in api10, afaik)Adames
can you please provide a code for doing so.. It would be really helpful.. ThanksAbstain
probably a simple intent BROWSE or VIEW with the http url to your file. Still I don't understand the subtelty here. Are you downloading a file (wifi or not, whatever) or are you not?Adames
I'm receiving a file over wifi-hotspot.. I know its weird.. :D but anyways thanks for your help.. :) if there's any progress i'll let keep you posted.. thanks.. :)Abstain
@Adames its not working.. Any other solution ??Abstain
don't understand the notion of receiving. Are you not asking for it in the first place?Adames
we are transferring a file over wifi hotspot.. we want the receiving side of the application to make the received file available for the Downloads application. nothing more.Abstain
still don't get how transferring is different from downloading (from the point of view of the client)Adames
T
0

Just use this folder as directory and make sure your app has permission to store data. Even if you check that permission in the manifest, you may need to go to your app settings and active it again (Or get that with an Intent):

string downloads_folder = 
  Path.Combine(
    Android.OS.Environment.ExternalStorageDirectory.AbsolutePath,
    Android.OS.Environment.DirectoryDownloads);

Then you can create/write/read any file and browse it in your device Downloads folder, i.e:

FileStream file= File.Create(Path.Combine(downloads_folder, "hello.txt");
Tarter answered 19/5, 2021 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.