There are 4 ways of getting HWID:

  1. ApplicationID

  2. Serial number (obsolete)

  3. IMEI (obsolete)

  4. MAC address (obsolete)

  5. AndroidID


Android versions dependency

Android 8 and above:      Neither Android serial number nor IMEI is accessible since Android 8.X OS.

Android 10 and above:    MAC based licensing is working, but limited, due to MAC randomization (more details below).

Android 13 and above:    MAC based licensing is not working anymore. Only working types are: ApplicationID and AndroidID.

  • ApplicationID-based licenses:
    • Binded to Android applicationID parameter of APK. (each different APK needs unique license)
    • Unlimited to number of devices (one license file for N devices)
  • MAC-based licenses:
    • Binded to specific MAC address of device's network interface. (each device needs unique license )
    • Unlimited to number of APKs (one license file of device can be used for N different applications)
    • Note: From Android 10 the MAC-based licensing works only for target SDK versions less than 30
    • Warning: MAC-based licensing is not supported since Android 13
  • AndroidID licenses:
    • Binded to specific Android device (each device needs unique license)
    • Unlimited to number of APKs (one license file of device can be used for N different applications)


1. ApplicationID based HWID

Returned by IEngine_GetHardwareId function in all Innovatrics' SDKs or by License manager desktop utility using command license_manager -c --appid "<your_aplicationID>".


    Example to get Application based HWID:

String hwid = new String(AnsiIso.getHardwareId());
showMessage("This device's HWID is: " + hwid);



2. Serial number based HWID

Returned by IEngine_GetHardwareId function in old versions of Innovatrics' SDKs (e.g. IDKit SDK v5.3.1, IFace SDK v3.2.2, ANSI&ISO SDK v2.1.0, Segmentation SDK v1.8.0 or older).



3. IMEI based HWID

Returned by IEngine_GetHardwareId function if no serial number is found. You can also find the IMEI of your device in Settings->About phone->Status or by entering a special code *#06# using the device's keypad according to http://www.phonearena.com/news/How-to-find-a-phones-IMEI-number_id62867. Please note that you have to add letter 'M' before the IMEI number and then add it to CRM license generator. For example if the IMEI=123456789012345 then the Hardware ID=M123456789012345. You also have to add following permission to application's manifest file in order to use IMEI as Hardware ID:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />


4. MAC address based HWID
MAC address based HWID is not returned by function IEngine_GetHardwareId. Look for Device status in Android phone settings to read the WiFi MAC address. Eventually, see this issue Get mac address on android device to find out how to get the MAC address.

In case you have decided to use MAC-based license, you also need to make sure the following permissions are in your project's manifest:    

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />


Since Android 10 you need to disable MAC address randomization to get a static hardware id.

It is only possible to disable MAC address randomization per Wi-Fi connection, so if you connect to another Wi-Fi network, the randomization will be turned on.

    

    Example to get MAC based HWID:

String macHwid = new String(AnsiIso.getHardwareId(AnsiIso.AnsiIsoHwidMethod.MAC_ADDR));
showMessage("This device's MAC HWID is: " + macHwid);


5. AndroidID based HWID

Implemented in the newest SDKs versions. Returned by getHardwareId function.

    Example

String hwida = new String(AnsiIso.getHardwareId(AnsiIso.AnsiIsoHwidMethod.ANDROID_ID));
showMessage("This device's Android ID HWID is: " + hwida);




NOTE:

IEngine_GetHardwareId function in C++ (method getHardwareId() in Java) is used to get the Hardware ID in IDKit SDK only. For other SDKs there are following functions to get he Hardware ID:
  • ANSI&ISO SDK - IEngine_GetHwid in C++, method getHardwareId() in Java
  • Segmentation SDK - ISegLib_GetHwid in C++,  method getHardwareId() in Java
  • IFace SDK - IFACE_Get_HardwareId