Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:40:00+00:00 2026-06-13T17:40:00+00:00

I’m working on an app that will download a zip file stored on Amazon

  • 0

I’m working on an app that will download a zip file stored on Amazon S3 via a Rails Heroku server after authenticating via oAuth 2. Here’s the flow:

  1. Request to authenticate with the server running on Heroku via
    oAuth2.
  2. Receive oAuth2 access token.
  3. Request to download the zip file from the server (passing the
    oAuth token as bearer).
  4. The server authorizes the request and redirects to an Amazon S3
    URL containing a expiring signature (to stop anyone downloading the
    content without being authenticated).

At this point, I want the DownloadManager to just follow the redirect and get the zip file from S3, however it’s failing. Is there some way I can work around this? Or is it just a limitation of DownloadManager?

I’m new to Android and still not totally up on the best debugging methods, so I don’t have a lot of output to show you. However, it seems that DownloadManager.COLUMN_STATUS == DownloadManager.STATUS_FAILED and DownloadManager.COLUMN_REASON is returning “placeholder”!

EDIT – Here is the code I’m using. Edited to hide the client etc…

    @Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Log.i("ChapterListActivity", "Item clicked: " + id);


    final DownloadManager downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);

    Uri uri = Uri.parse("http://myapphere.herokuapp.com/api/v1/volumes/2.zip");

    DownloadManager.Request request = new Request(uri);

    String accessToken = getSharedPreferences("keyhere", MODE_PRIVATE).getString("access_token", null); 

    Log.i("SLEChapterListActivity", "Getting file with access token... " + accessToken);

    request.addRequestHeader("Authorization", "Bearer " + accessToken);
    long reference = downloadManager.enqueue(request);

    IntentFilter filter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);

    BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            long downloadReference = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
            Log.i("ChapterListActivity", "Download completed");


            Query query = new Query();
            query.setFilterById(downloadReference);

            Cursor cur = downloadManager.query(query);

            if (cur.moveToFirst()) {
            int columnIndex = cur.getColumnIndex(DownloadManager.COLUMN_STATUS);
            if (DownloadManager.STATUS_SUCCESSFUL == cur.getInt(columnIndex)) {
                String uriString = cur.getString(cur.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));

                File mFile = new File(Uri.parse(uriString).getPath());

            } else if (DownloadManager.STATUS_FAILED == cur.getInt(columnIndex)){
                String statusResult = cur.getString(cur.getColumnIndex(DownloadManager.COLUMN_REASON));
                Toast.makeText(context, "FAILED " + statusResult, Toast.LENGTH_SHORT).show();
            } else if (DownloadManager.ERROR_TOO_MANY_REDIRECTS == cur.getInt(columnIndex)){
                String statusResult = cur.getString(cur.getColumnIndex(DownloadManager.COLUMN_REASON));
                Toast.makeText(context, "TOO MANY REDIRS " + statusResult, Toast.LENGTH_SHORT).show();
            }
        }
        }
    };

    registerReceiver(receiver, filter);

}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:40:02+00:00Added an answer on June 13, 2026 at 5:40 pm

    I’ve found in Download Manager sources (line 500):

    3xx: redirects (not used by the download manager)

    It’s not supported, yet.

    In my current project, downloads are made in two steps:

    1. Get Amazon url from our own server via oAuth2
    2. Enqueue DownloadManager with the Amazon url.

    If you don’t like the two step process, I don’t, then take a look at RoboSpice project, it has similar philosophy as DownloadManager.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.