1package com.Pixo.PixoPlatform;
3import android.os.Build;
4import java.lang.reflect.Method;
5import android.util.Log;
6import android.Manifest.permission;
7import android.net.wifi.WifiManager;
8import android.net.wifi.WifiInfo;
9import java.net.NetworkInterface;
11import java.util.Collections;
19 Class<?> c = Class.forName(
"android.os.SystemProperties");
20 Method
get = c.getMethod(
"get", String.class);
22 serialNumber = (String)
get.invoke(c,
"gsm.sn1");
23 if (serialNumber.equals(
""))
24 serialNumber = (String)
get.invoke(c,
"ril.serialnumber");
25 if (serialNumber.equals(
""))
26 serialNumber = (String)
get.invoke(c,
"ro.serialno");
27 if (serialNumber.equals(
""))
28 serialNumber = (String)
get.invoke(c,
"sys.serialnumber");
29 if (serialNumber.equals(
""))
30 serialNumber = Build.SERIAL;
33 if (serialNumber.equals(
""))
35 }
catch (Exception e) {
45 Log.d(
"PixoUtilities",
"Getting mac address.");
47 List<NetworkInterface> ifaceList = Collections.list(NetworkInterface.getNetworkInterfaces());
48 for (NetworkInterface iface : ifaceList) {
52 if (!iface.getName().equalsIgnoreCase(
"wlan0")) {
55 byte[] macBytes = iface.getHardwareAddress();
56 if (macBytes ==
null) {
59 StringBuilder macSb =
new StringBuilder();
60 for (
byte bytes : macBytes) {
61 macSb.append(String.format(
"%02X", bytes));
63 if (macSb.length() == 0) {
66 return macSb.toString();
68 }
catch (Exception ex) {