I'm writing an application which determines its place by getting the MAC-Address of the current router it is connected to, then sends this address to a server which will then give the name of the location, found in a database.
The problem I have now is how to get the MAC-address. So far I tried something like this:
In the emulator this crashes, but I figured that might be normal since WIFI isn't emulated. So I tried using a bootable android version (http://www.android-x86.org/) on my laptop. Same result there. Sadly I don't have a android phone yet, so I can't really test it. And since these classes aren't really well documented I'm not sure if I can just hope this will run, or if I need to look for something else.
So my question is, am I using the right code? Or do I need to find a different solution to my problem.
Thanks in advance,
Okay.... I solved my problem -.- I'm almost ashamed to say what it was, but for anyone else having this problem...
My mistake was it that I did not use the ACCESS_WIFI_INFO permission in my manifest file. After that my app ran fine. Although I'm still curious why the getBSSID() function gives the MAC-Address of the router and not the getMacAddress() function. This returned null.