Click here to Skip to main content
15,791,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a self attendance android App. But I am getting issue to get router IP address, mac address and its name so that if employee get connected with specific router they can mark their attendance using my android app. But I am facing problem in getting information of router. Or if another way to do this attendance then please let me know.


My Code is here...........

What I have tried:

public  String getMacAddress_(Context context) {
        WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        WifiInfo info = wifi.getConnectionInfo();
        String mac = info.getMacAddress();
        return mac;
Updated 13-May-20 12:07pm
David Crow 14-May-20 8:54am    
Have you tried something like:

DhcpInfo dhcp = wifi.getDhcpInfo();
Log.i(TAG, "Gateway = " + dhcp.gateway);

1 solution

Perhaps this answer from SO will help you out;
I did see that it has MAC and SSID, but did not see IP

Stack Overflow : How to get name of wifi-network out of android using android API?[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900