Witek
Witek

Reputation: 6462

How to start the default Android Downloads Activity or App?

My app saves a file in the default downloads folder. Which is determined by Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).

Now I want open thee default Android Downloads Activity or App, so the user sees the downloads folder with my new file.

Upvotes: 1

Views: 1176

Answers (3)

ViratBhavsar
ViratBhavsar

Reputation: 104

Please try this method.

public void openFolder() {
   Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
   Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS));
   intent.setDataAndType(uri, "resource/folder"); 
   startActivity(Intent.createChooser(intent, "Open folder"));
}

Upvotes: 1

R. Zagórski
R. Zagórski

Reputation: 20258

I believe this is the code you are looking for:

Intent intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
startActivity(intent);

Upvotes: 2

Sergey Glotov
Sergey Glotov

Reputation: 20346

I guess you need DownloadManager.ACTION_VIEW_DOWNLOADS

Intent viewDownloadsIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
startActivity(viewDownloadsIntent);

Upvotes: 2

Related Questions