One problem with the wi-fi MAC address is that on some devices (so I
hear) the MAC address is not available from the WiFiManager if wi-fi
happens to be turned off. Therefore I intend to prompt the user to
turn on wi-fi during the licensing process if it is not already on.
And if the device does not have wi-fi, then I intend to fall back to
the Android_ID as my unique identifier.
With all that said, I would like to know how to tell when the MAC
address is unavailable. The devices that I have tested on all yield
up a MAC address even when wi-fi is turned off, so I am not fortunate
enough to own one of those troublesome devices. So for those devices
I would like to know what to expect. Here is how I get the wi-fi MAC
address:
WifiManager wfManager;
WifiInfo wifiinfo;
wfManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
wifiinfo = wfManager.getConnectionInfo();
String macAddr = wifiinfo.getMacAddress();
So my question is what should I expect this code to do when running on
a device that "fails" to return the MAC address when wi-fi is turned
off. (Exception? Null string?). Also what should I expect this code
to do on a device that does not have wi-fi hardware?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Go to Master Mind Home Base Income Website :-
Unsubscribe All Group Post :- http://j.gs/624707/unsubscribe
http://q.gs/624707/unsubscribe
Subscribe All Group Post :- http://j.gs/624707/subscribe
Join Now Today (Paid Income) :-
On Dec 5, 8:07 pm, lbendlin <l...@bendlin.us> wrote:
> try the following. Reboot the device with wifi off, and then run your code.
> You will see how the device behaves.
>
> What you have seen so far is just a mean way of caching. When Wifi is on,
> the MAC address is remembered by the system even if you then switch WiFi
> off.
Yes! Super. I get null for wifiinfo.getMacAddress()
OK, now I know what to expect in that situation. But what will I see
on a device that does not have wi-fi hardware?
--
1. wi-fi turned off
2. no wi-fi hardware present on this device
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_WIFI
???
7 декабря 2011 г. 0:41 пользователь RLScott <fixtha...@yahoo.com> написал:
On Dec 6, 3:59 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Have you tried:
>
> http://developer.android.com/reference/android/content/pm/PackageMana...
>
> ???
>
> 7 ÄÅËÁÂÒÑ 2011šÇ. 0:41 ÐÏÌØÚÏ×ÁÔÅÌØ RLScott <fixthatpi...@yahoo.com> ÎÁÐÉÓÁÌ: