Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get the MAC Address of the access points

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 413
    Comment on it

    Please note that every device that needs to be connected has a MAC address associated with it, be it a phone or the router. The MAC address for the device can be seen in the WiFi settings in case of the phone. For getting the MAC address of the router, we can use the following code:

    WifiManager wifiMgr = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
    String macAddress = wifiMgr.getConnectionInfo().getBSSID();    

    Where the basic service set identifier (BSSID) of the current access point is in the form of a six-byte MAC address: XX:XX:XX:XX:XX:XX

    The BSSID may be null if there is no network currently connected.

    Also, make sure to add the permissions in project's manifest file:

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: