Code example for WifiManager

Methods: getConnectionInfo

0
     
     
    protected static String getWifiMacAddress(Context context) throws Exception {
        WifiManager manager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        WifiInfo wifiInfo = manager.getConnectionInfo();
        if (wifiInfo == null || wifiInfo.getMacAddress() == null)
            return md5(UUID.randomUUID().toString());
        else return wifiInfo.getMacAddress().replace(":", "").replace(".", "");
    } 
     
     
	public static Boolean hasHardwareMenuButton(Activity activity)
    { 
    	if(android.os.Build.VERSION.SDK_INT>11){
    		if(android.os.Build.VERSION.SDK_INT>14)
    			return ViewConfiguration.get(activity.getBaseContext()).hasPermanentMenuKey();
    		return false; 
    	} 
    	return true; 
    }