My app will not be distributed through the Marketplace but directly by
me.  And I have a licensing method that relies on a unique ID in the
device.  I realize that this means customers will have to contact me
for a new activation if they switch devices and that is OK.  But I
don't want to make the customer go through that trouble if they just
happen to reinitialize their device.  If I used the Android_ID as my
unique ID then reinitializing a device would produce a different
Android_ID.  So I don't want to use that.  I also don't want to use
the IMEI of the phone for several reasons.  One is that some devices
are not phones.  The other is that people are suspicious of apps that
declare the need to access the telephony stack.  So that leaves the wi-
fi MAC address.

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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to