brief introduction
Link to this article:
https://segmentfault.com/a/11…
According to the technical requirements of “mobile intelligent terminal supplementary equipment identification system”, Huawei, Xiaomi, oppo, vivo, ZTE, Nubia, Meizu, Lenovo, Samsung and other equipment manufacturers will gradually realize this identification system. The alliance plans to develop and release a unified supplementary equipment identification call SDK supporting multiple manufacturers, Assist mobile application developers to access mobile intelligent terminals more conveniently, supplement device identification system and promote relevant services.
The full name of oaid is open anonymous device identifier, which is an identifier that can connect all application data. It is generated immediately after the mobile terminal system is started for the first time and can be used for advertising business. The generation parameters can include the device unique identifier parameters.
IMEI belongs to personal privacy. Now IMEI cannot be obtained, so oaid needs to be used instead. This article will use the latest version of SDK 1.0.25 provided by MSA (as of 2021-02-01)
SDK Download
Here are the resources shared by a big man on GitHubhttps://github.com/2tu/msaI’ve been looking for it for a long time. Thank you.
oaid_ sdk_ 1.0.25. Zip dial linkhttps://pan.baidu.com/s/1sVzBD_3mTXD_oqyu5I2VtQExtraction code: we54
The official website download needs to be registered in the name of the company and needs to be reviewed. It’s troublesome. The SDK download found online still needs to be charged.
Official website:Mobile security alliance MSA
Supported version
Manufacturer name | Supported version |
---|---|
Huawei | HMS 2.6.2 and above |
millet | MIUI 10.2 and above |
vivo | Android 9 and above |
OPPO | Color OS 7.0 and above |
Lenovo | Zui 11.4 and above |
Samsung | Android 10 version |
Meizu | Android 10 version |
Nubia | Android 10 version |
ZTE | Android 10 version |
ASUS | Android 10 version |
One plus | Android 10 version |
Black Shark | Android 10 version |
Motorola | Android 10 version |
Freeme OS | Android 10 version |
Start using
Be sure to use the latest version!
Be sure to use the latest version!
Be sure to use the latest version!
I started with the old version and encountered many problems. MSA has been improving the SDK, so please be sure to use the latest version!
I tested this version on Xiaomi of Android 11
Put oaid_ sdk_ 1.0.25. Copy AAR to the LIBS directory of the item and set the dependency.
implementation files('libs/oaid_sdk_1.0.25.aar')
Set supplierconfig Copy JSON to the project assets directory, and modify the corresponding content of the edge, especially the part where the appid needs to be set. The part that needs to set appid needs to register its own app in the app store of the corresponding manufacturer. It should be noted that there is no need to modify the label part.
Core code, from the official demo
public class MainActivity extends AppCompatActivity implements IIdentifierListener {
private TextView tvContent;
String oaid;
String vaid;
String aaid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvContent = findViewById(R.id.tv);
MdidSdkHelper.InitSdk(getApplicationContext(), true,this);
//The result is returned asynchronously. If it is empty, you can sleep for a few seconds first
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("OAID: "+oaid);
System.out.println("VAID: "+vaid);
System.out.println("AAID: "+aaid);
}
@Override
public void OnSupport(boolean b, IdSupplier idSupplier) {
if(idSupplier==null) {
return;
}
oaid=idSupplier.getOAID();
vaid=idSupplier.getVAID();
aaid=idSupplier.getAAID();
StringBuilder builder=new StringBuilder();
builder.append("support: ").append(idSupplier.isSupported()?"true":"false").append("\n");
builder.append("OAID: ").append(oaid).append("\n");
builder.append("VAID: ").append(vaid).append("\n");
builder.append("AAID: ").append(aaid).append("\n");
String idstext=builder.toString();
Log.d("SdkDemo: ", idstext);
onIdsAvalid(idstext);
}
public void onIdsAvalid(@NonNull final String ids) {
runOnUiThread(new Runnable() {
@Override
public void run() {
tvContent.setText(ids);
}
});
}
}
Possible problems
The return of oaid is asynchronous, so sometimes it may not be returned after execution. At this time, there will be problems in use. It is recommended to judge it empty before use. If it is empty, sleep for a while
Alternatives
Here are two alternatives recommended
https://github.com/shuzilm-open-source/Get_Oaid_CNAdid
https://github.com/gzu-liyujiang/Android_CN_OAID
Apk Download
Here is a compiled APK. You can try the effect on the machine. It has passed the test on my android 11 Xiaomi mobile phone. You can install it without any permission.
https://pan.baidu.com/s/1vRYPJ5zSVm87LYbxiyV-VQExtraction code: 2gr9
Write at the end
If you have any questions, you are welcome to point out in the comment area. The follow-up will also be continuously updated with the new version of the SDK. If you think this blog is helpful to you, you might as well like it before you go.