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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:38:27+00:00 2026-05-24T15:38:27+00:00

Maybe I’m asking the wrong question, but I can’t seem to find what I’m

  • 0

Maybe I’m asking the wrong question, but I can’t seem to find what I’m looking for, so I’ll try ask it here instead of google.

Basically, I have the following code, from which I can glean if I am on wifi, 3G or something else (tethering comes to mind).

    // Iterate over all network interfaces.
    for (Enumeration<NetworkInterface> en = 
        NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
        {
            NetworkInterface intf = en.nextElement();
            // Iterate over all IP addresses in each network interface.
            for (Enumeration<InetAddress> enumIPAddr = 
                intf.getInetAddresses(); enumIPAddr.hasMoreElements();)
            {
                InetAddress iNetAddress = enumIPAddr.nextElement();
                // Loop back address (127.0.0.1) doesn't count as an in-use 
                // IP address.
                if (!iNetAddress.isLoopbackAddress())
                {
                    sLocalIP = iNetAddress.getHostAddress().toString();
                    sInterfaceName = intf.getName();
                }
            }
        }

I believe the important part here is sInterfaceName = intf.getName();

Now on the Galaxy S and Galaxy S Tab, this seems to return “eth0” when you are connected to WiFi and “pdp0” when connected to 3G

That said, I’ve only really been able to test with 1 x Galaxy S and 1 x Galaxy S Tab as they are the only Android devices I have. I imagine the network interface name is set somewhere in the kernel by the device manager. I could probably troll through the kernel for each device, but I figured someone must have found this info out already, any suggestions on where to look or what to search in google?

  • 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-24T15:38:27+00:00Added an answer on May 24, 2026 at 3:38 pm

    You should use easier approach. Call ConnectivityManager‘s function that returns current active network – getActiveNetworkInfo(). Having an instance of NetworkInfo you can call getType() and getSubtype() to get network type that is currently in use.


    Here is an example:

    NetworkInfo info = m_connectivityManager.getActiveNetworkInfo();
    int netType = info.getType();
    int netSubtype = info.getSubtype();
    
    if (netType == ConnectivityManager.TYPE_WIFI || netType == ConnectivityManager.TYPE_WIMAX)  
    {
       //no restrictions, do some networking
    }
    else if (netType == ConnectivityManager.TYPE_MOBILE && 
         netSubtype == TelephonyManager.NETWORK_TYPE_UMTS)
    {
       //3G connection
       if(!m_telephonyManager.isNetworkRoaming())
       {
          //do some networking
       }      
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe this question is duplicate, but I can not find an answer for my
Maybe this is a simple question, but I didn't find answer in web. I
Maybe there is a similar question to this, but I couldn't find a one.
Maybe a silly question but here goes anyway. Example: Let's say I have one
Maybe it's a simple question but I can't figure out the right way to
Maybe this is a dumb question, but is there any way to convert a
Maybe this is a dumb question, but I have the following behavior in Visual
Maybe this cannot be done, but please help or suggest how this can be
Maybe I am out of my mind right now, but I have a question
maybe a few others already asked that but I couldn't find any answer to

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.