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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:10:07+00:00 2026-06-05T03:10:07+00:00

My application requires using internet connection to download some file from a link. I

  • 0

My application requires using internet connection to download some file from a link. I have a internet connection which uses proxy and needs authentication. Somehow when I try to connect to internet it never asks for this authentication hence is unable to download file.

What I want to ask is that is there any way to detect if the internet connection of the user requires authentication to download files from internet, so that in-case if it is required my application can ask the user to open a normal internet browser of device and provide the wanted authentication.

  • 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-05T03:10:09+00:00Added an answer on June 5, 2026 at 3:10 am

    This is a very genuine case and will cause trouble when your application tries to access internet in an organizational body like in an institute or company which uses proxy for letting users to connect to internet.

    As I have not received any answer on this question I am going to tell the procedure followed by me for checking this, as sometimes for your application to be unable to access internet can make it dead.

    At first I check if internet connection is available on the device by simple state checking of the device using this

     final ConnectivityManager conMgr =  (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
                    final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo();
    
                    if (activeNetwork != null && activeNetwork.getState() == NetworkInfo.State.CONNECTED) {
    
                                    //Do what ever you wish to do
    
                                    } else {
                                          // Display message internet connection not available
                                          }
    

    The above code gives information on whether internet connection is available or not but it fails to tell if the internet connection requires authentication (hence leading to nothing getting downloaded or corrupted file or zero size file to be created in the download file location), hence after checking the above condition I try to access a link to download and then use this logic.

    I have provided a link to a small .zip file from internet which my application tries to download when a button to access internet is pressed (like user clicking on “update the database” of application). I have used the information given in this question ( Download and Extract Zip File in Android ), and then I extract the downloaded file in a unzipping location.

    After this I have created a check option (being already aware of exact name of the file that exists inside the .zip file), which checks whether this file has been created in the unzipping location mentioned by me while unzipping.

    If the file does not exist, you just give them an option to open browser and provide the authentication and then return back to your application like such:

     private void unableToConnectToInternetDialog() {
                    // TODO Auto-generated method stub
                    String Message ="CHECK IF:" +
                            "your internet connection uses proxy, if yes please follow these steps:" +
                            "\n 1 Open default Internet Browser" +
                            "\n 2 Open any webpage requiring authentication" +
                            "\n 3 Provide the authentication" +
                            "\n 4 Resume this application";
    
                    // TODO Auto-generated method stub
                    AlertDialog.Builder builderInternet = new AlertDialog.Builder(AppPage1.this);
                    builderInternet.setMessage(Message)
                            .setTitle("Unable to connect to Internet")
                           .setCancelable(false)
                           .setPositiveButton("Open Browser", new DialogInterface.OnClickListener() {
                               public void onClick(DialogInterface dialog, int id) {
                                   // Opening mobile's default browser to set the authentication
                                   String url = "http://www.google.com";
                                   Intent i = new Intent(Intent.ACTION_VIEW);
                                   i.setData(Uri.parse(url));
                                   startActivity(i);
                               }
                           })
                           .setNegativeButton("Skip Update", new DialogInterface.OnClickListener() {
                               public void onClick(DialogInterface dialog, int id) {
                                   // Do the needful
    
                               }
                           });
                    builderInternet.create().show();
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Windows 8 application using HTML5. The application requires some user data
i have one application which is build using VB.NET now i required to add
My application requires that I have access to the file system. Regardless if the
I have a question concerning encryption, more specifically encryption that requires no internet connection
I got this application from the internet and I want to add some modifications.
I'm currently writing an application using Vala that requires me to send data over
I have the following code using require.js. utilities.js: define([thirdparty-script-A.js], function(){ ... }); application.js: define([utilities,
My application requires events to be fired based on some specific activities that happen.
I have an HTML5 application that requires offline support. For running the application, I
I have written an application that unit tests our hardware via a internet browser.

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.