OAID

AndroidAnonymous device identifierOAIDThe output


background

With the advent of the era of big data and artificial intelligence, the value of data has gradually increased, and the collection and use of terminal device identification information, such as the International Mobile Device Identity (IMEI), Wi-Fi MAC address, SIM card International Mobile User Identity (IMSI) and Bluetooth address, has become a common phenomenon. At the same time, countries have higher and higher requirements for user privacy protection. Traditional mobile device identifiers such as International Mobile Device Identity (IMEI) have been recognized as part of user privacy in some countries. In addition, in many scenarios unrelated to privacy, such as production, after-sales service, customs clearance, government sampling and other scenarios, traditional equipment identification codes (such as IMEI) are tampered with or falsely used from time to time, which brings losses to the economic interests of equipment manufacturers and has a great impact on equipment traceability.

ID that

  • Unique device IDENTIFIER (UDID): unique hardware identifier of a device. It is generated based on specific hardware information during device production and can be used to verify the production environment and validity of the device. Third-party applications are not provided with access interfaces and cannot be obtained through the SDK.
  • Anonymous Device Identifier (OAID): An identifier that can connect all application data. It is generated immediately after the smart mobile terminal system starts for the first time and can be used for advertising services. You can obtain the interface status (reset, disable) and ID value from the SDK.
  • Developer Anonymous Device Identifier (VAID): A device identifier that is open to developers and can be generated when an application is installed to make recommendations between different applications from the same developer. You can obtain the ID value from the SDK.
  • Application Anonymous Device Identifier (AAID): An anonymous device identifier obtained by a third-party application. It can be generated during application installation and used for user statistics. You can obtain the ID value from the SDK.

Right to declare

  • Mobile intelligent terminal complement unified identity system calls the SDK by China academy of information communication, terminal integration provide laboratory, mobile security alliance, intellectual property rights owned by China mail tunnels institutes, unauthorized or illegal copying, reverse, cracking, tampered with, sold or used for other commercial purposes, China’s information and communications research institute reserves the right to pursue its legal responsibility;
  • Mobile intelligent terminal supplement device identification system uniformly calls SDK. China Academy of Information and Communications Technology (CAICT) Tel Terminal Laboratory and Mobile Security Alliance are jointly responsible for the compliance management and later maintenance of SDK.
  • Mobile intelligent terminal complement equipment identification system based on telecommunication terminal industry association (TAF), mobile security alliance (MSA) launched the group standard “mobile intelligent terminal complement equipment identification code development, mobile intelligent terminal complement unified identity system calls the SDK integration equipment vendors interface, authorization and access to mainstream equipment manufacturers, This version is a trial version.

download

SDK obtain address

The installation

  • themiit_mdid_x.x.x.aarCopy to itemlibsX.X.X indicates the version number.
  • willsupplierconfig.jsonCopy to projectassetsDirectory, and modify the corresponding contents, especially the part that needs to set the APPID. The part that needs to set the APPID needs to register its app in the corresponding manufacturer’s app store.
  • Set dependencies.
Implementation files (' libs/miit_mdid_x X.X.A ar ')Copy the code
  • Obfuscate Settings.
-keep class com.bun.miitmdid.core.** {*; }Copy the code
  • Set gradle compilation options, which can be configured according to your platform choice.
    ndk {
        abiFilters 'armeabi-v7a'.'x86'.'arm64-v8a'.'x86_64'.'armeabi'
    }
    packagingOptions {
        doNotStrip "*/armeabi-v7a/*.so" 
        doNotStrip "*/x86/*.so" 
        doNotStrip "*/arm64-v8a/*.so" 
        doNotStrip "*/x86_64/*.so"
        doNotStrip "armeabi.so"
    }
Copy the code
  • Initialization.
public class APP extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base); JLibrary.InitEntry(base); }}Copy the code
  • Set the callback
public interface AppIdsUpdater {
        void OnValidId(@NonNull JSONObject ids);
    }
Copy the code
  • Set the calling class
public class MiIdHelper implements IIdentifierListener {
    private boolean isSupport;
    private String oaid, vaid, aaid;

    public JSONObject getDeviceIds(Context cxt) {
        long startTime = System.currentTimeMillis();
        int code = CallFromReflect(cxt);
        long endTime = System.currentTimeMillis();
        long time = endTime - startTime;
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("description", descriptionCode(code));
            jsonObject.put("code", code);
            jsonObject.put("time", time);
            jsonObject.put("isSupport", isSupport);
            jsonObject.put("oaid", oaid);
            jsonObject.put("vaid", vaid);
            jsonObject.put("aaid", aaid);
        } catch (Exception e) {
            e.printStackTrace();
        }
         return jsonObject;
    }

    private int CallFromReflect(Context cxt) {
        return MdidSdkHelper.InitSdk(cxt, true.this);
    }


    @Override
    public void OnSupport(boolean isSupport, IdSupplier _supplier) {
        this.isSupport = isSupport;
        if(_supplier ! =null) {
            this.oaid = _supplier.getOAID();
            this.vaid = _supplier.getVAID();
            this.aaid = _supplier.getAAID(); _supplier.shutDown(); }}private String descriptionCode(int code) {
        switch (code) {
            case ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT:
                return "DEVICE_NOSUPPORT";
            case ErrorCode.INIT_ERROR_LOAD_CONFIGFILE:
                return "LOAD_CONFIGFILE";
            case ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT:
                return "MANUFACTURER_NOSUPPORT";
            case ErrorCode.INIT_ERROR_RESULT_DELAY:
                return "RESULT_DELAY";
            case ErrorCode.INIT_HELPER_CALL_ERROR:
                return "HELPER_CALL_ERROR";
            default:
                return "SUCCESS"; }}}Copy the code
  • Get OAID
    MiIdHelper miIdHelper = new MiIdHelper();
    JSONObject result=miIdHelper.getDeviceIds(getApplicationContext());
Copy the code

Results show

{
    "description":"SUCCESS"."code":0."time":49."isSupport":true."oaid":"cf8cc008bb5adf96"."vaid":"f8239c19f92836f1"."aaid":"0115d997-c845-4e86-8fed-58c4fb246827"
}
Copy the code

The Demo access

Demo