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 9240749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:14:39+00:00 2026-06-18T08:14:39+00:00

I am developing an app that updates independently from the Android Play Store. On

  • 0

I am developing an app that updates independently from the Android Play Store. On start-up it checks for a newer version and downloads the new .apk file from the server if required.

The problem is that the .apk file download url executed by HTTP request, is redirected to a Vodafone landing page asking to change the mobile internet settings. The .apk file downloaded by the app is then actually this html webpage.

enter image description here

Visiting any website through the android internet browser does not get redirected to this page. My MIME settings on the hosting server is correctly set up. I am using the same code, hosting provider and mobile carrier on another project without any problems, although that project is running Toshiba tablets on OS 3.2 and this project is Samsung tablets on OS 4.1.

What can I test or change to get it working, or is it some carrier or tablet/OS related problem? Any help would be appreciated. The related code is included below if someone wants to check it, but as mentioned I have no problems with it on another project.

private class UpdateDownloadTask extends AsyncTask<Void, Void, String> {

HttpClient httpclient;
HttpGet httpget;
HttpResponse response;
HttpEntity httpentity;
OutputStream outputStream;

protected void onPreExecute () {

    //do not lock screen or drop connection to server on login
    activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);                  
    //initiate progress dialogue to block user input during initial data retrieval
    ProcessingDialog = ProgressDialog.show(context, "Please Wait", "Downloading Updates", true,false);
}

@Override
protected String doInBackground(Void... nothing) {

    try {
        //set timeouts for httpclient
        HttpParams httpParameters = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParameters, 5000);
        HttpConnectionParams.setSoTimeout(httpParameters, 5000);

        //setup http get
        httpclient = new DefaultHttpClient(httpParameters);             
        httpget = new HttpGet(uriApk);

        // Execute HTTP Get Request
        response = httpclient.execute(httpget);
        httpentity = response.getEntity();

        //create location to store apk file
        String path = Environment.getExternalStorageDirectory() + "/download/";
        File file = new File(path);
        file.mkdirs();  //if download folder not already exist
        File outputFile = new File(file, apkName);

        //write downloaded file to location
        outputStream = new FileOutputStream(outputFile, false);
        httpentity.writeTo(outputStream);
        outputStream.flush();
        outputStream.close();

        return "success";
    }

    catch (Exception e) {
        return "error: " + e.toString();
    }

}

@Override
protected void onPostExecute(String result) {

    //check if result null or empty
    if (result.length() == 0 || result == null) {

        Toast.makeText(context, "Could Not Download Updates, Please Try Again. Closing Application.", Toast.LENGTH_LONG).show();
        activity.finish();
    }           
    //update downloaded
    if (result.equals("success"))   {
        //install downloaded .apk file
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + apkName)), "application/vnd.android.package-archive");
        activity.startActivity(intent);               
        //activity.finish();
    }
    //update not downloaded
    else {
        Toast.makeText(context, "Could Not Download Updates, Please Try Again. Closing Application.", Toast.LENGTH_LONG).show();                
        activity.finish();
    }           

    //close update dialog
    try {
        ProcessingDialog.dismiss();
    } catch (Exception e) {
        // nothing
    }
    //release screen lock
    activity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
  • 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-18T08:14:40+00:00Added an answer on June 18, 2026 at 8:14 am

    I had to set carrier setting to “Do not adapt any sites” through the Android internet browser. After that I added the following code to get it working.

    httpget.setHeader("Accept", "application/vnd.android.package-archive");
    httpget.setHeader("Content-Type", "application/vnd.android.package-archive");
    String userAgent = "Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1";
    httpget.setHeader("User-Agent", userAgent); 
    

    Hope this helps someone else with the same problem.

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

Sidebar

Related Questions

i am currently developing an app that requires location from the start. I have
I am developing a library for Android that requires frequent updates from a central
I'm developing an app that downloads some information from internet. At the beginning of
I'm developing a web based app that checks for updates on the server and
i'm developing an app that has a jtable and user could start a download.
I'm developing an app that periodically fetches data from server. Now I'm using a
I'm developing an Android app that needs to do some updating in the background
I've got an app that needs developing cross platform with sporadic updates depending on
I'm in the process of developing an iOS app that retrieves images from a
I'm developing an app that receive contente (URI) and I'm testing it with IE10

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.