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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:28:33+00:00 2026-05-30T17:28:33+00:00

My app needs internet connection in order to retrieve longitude and latitude. How can

  • 0

My app needs internet connection in order to retrieve longitude and latitude. How can I show a popupbox at the beginning of my app if the phone’s network is turned off? The popupbox should says something like this:

Your network is disable, enable now?

Under this text a button will be placed, which says “OK”, when the user presses this the WiFi or mobile network will be turned on.

Thanks in advance

  • 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-05-30T17:28:35+00:00Added an answer on May 30, 2026 at 5:28 pm

    You shouldn’t automatically turn on the WiFi for your users, and I’m not sure that’s even possible with the mobile network.

    Here’s a sample code which creates an AlertDialog in the end of the onCreate method, and shows it to the user. In case the user wants to enable it he will be forwarded to the Android wireless settings screen, where he can manually enable the WiFi connection.

    In case he clicks cancel, the application will quit. However, you can model this behavior to your taste, this is just an example of how I would accomplish this particular task.

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        // your code
    
        new AlertDialog.Builder(this)  
           .setMessage("Your network is disabled, enable now?")  
           .setTitle("Alert")  
           .setCancelable(false)
           .setPositiveButton(android.R.string.ok, 
               new DialogInterface.OnClickListener() {  
                   public void onClick(DialogInterface dialog, int whichButton) {
                       // launch settings
                       Intent settings = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
                       startActivity(settings);
                   }  
               })
           .setNegativeButton(android.R.string.cancel,
               new DialogInterface.OnClickListener() {  
                   public void onClick(DialogInterface dialog, int whichButton) {
                       dialog.dismiss();
    
                       // finish activity
                       finish();
                   }  
               })
           .show();
    }
    

    EDIT:

    Just double-checked the Settings intent against the Android Developer documentation (http://developer.android.com/reference/android/provider/Settings.html#ACTION_WIRELESS_SETTINGS), and they advise you that sometimes this Activity may not exist:

    Activity Action: Show settings to allow configuration of wireless
    controls such as Wi-Fi, Bluetooth and Mobile networks. In some cases,
    a matching Activity may not exist, so ensure you safeguard against
    this.

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

Sidebar

Related Questions

I want to check the internet connection in my iPhone app. The app needs
My App needs a Internet Connection which is checkt in the ViewDidLoad if there
I'm creating an app that needs internet connection. So when the WiFi setting is
I am making a wxpython app that needs to have internet connection as a
I'm developing an app that needs internet connection to get informations from a sql
I want to test an iPad app that needs an internet connection. I want
My app needs to install some files that can be edited by the application
I'm working on Internet based app,so i need to monitor Internet Connection. link I
Is there a way my app (OS X, 10.7 target) can determine the internet
I am developing a web app which needs to check the internet if got

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.