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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:53:32+00:00 2026-05-20T03:53:32+00:00

I’m writing an app for Android that spawns a service that periodically checks the

  • 0

I’m writing an app for Android that spawns a service that periodically checks the wifi state and changes it based on some conditions. My problem is that whenever I try to create a WifiManager object to check the state of the wifi (and perhaps control it), it gives me an uninitialized object. Here is the code:

public class WifiCheckerService extends Service {

    // Service code and run() method

    private void checkWifi() {
        WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
        System.out.println(wifi.getConnectionInfo());
        // Rest of code
    }
}

And here is the line in the log when it gets to this code.

02-18 05:22:59.274: INFO/System.out(1170): SSID: <none>, BSSID: <none>, MAC: <none>, Supplicant state: UNINITIALIZED, RSSI: -200, Link speed: -1, Net ID: -1

Obviously I’m not getting the system WifiManager object. I know it has something to do with the fact that I am in a service which is a thread, but I am still having trouble understanding the concept and a little explanation about why it’s not working and how I can fix it would be greatly appreciated.

(On a sort of unrelated note, I think an explanation would also explain why I can’t use the line Toast.makeText(getBaseContext(), "Checking Wifi...", Toast.LENGTH_SHORT).show(); in the service)

  • 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-20T03:53:33+00:00Added an answer on May 20, 2026 at 3:53 am

    Have you enabled the wifi on your device?

    If your wifi is not enabled, it will show you UNINITIALZED output.

    I just tried your code and it works fine with wifi enabled:

    WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    WifiInfo w = wifi.getConnectionInfo();
    Log.d(LOG_TAG, w.toString());
    

    Logcat:

    E/wpa_supplicant( 4337): wpa_driver_priv_driver_cmd failed
    E/wpa_supplicant( 4337): wpa_driver_priv_driver_cmd failed
    W/ActivityManager( 1332): Activity idle timeout for HistoryRecord{454624f8 com.xxx.xxx/.ui.SomeScreen}
    D/SomeScreen( 4365): SSID: <none>, BSSID: <none>, MAC: 00:26:E8:B7:D2:E0, Supplicant state: DORMANT, RSSI: -200, Link speed: 54, Net ID: -1
    
    • 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 &#8217; in it. SimpleXML turns this
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
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I have some data like this: 1 2 3 4 5 9 2 6
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.