Introduction to the
Link to this article: juejin.cn/post/692419…
According to the technical requirements of “Mobile Intelligent Terminal Supplementary Device 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 unified supplementary device identification calling SDK supporting multiple manufacturers. Assist mobile application developers to more conveniently access mobile intelligent terminal supplement device identification system, and promote relevant business.
OAID Is an Open Anonymous Device Identifier that can connect all application data. It is generated immediately after the mobile terminal system starts for the first time and can be used for advertising services. The generated parameters can include the unique identifier of the device.
IMEI is private and cannot be obtained now. Therefore, OAID should be used instead. This article will use the latest SDK 1.0.25 provided by MSA (as of 2021-02-01)
Download the SDK
Github github.com/2tu/msa I have been looking for it for a long time. Thank you.
Oaid_sdk_1.0.25. zip Disk link pan.baidu.com/s/1sVzBD_3m… Extraction code: WE54
The official website download needs to be registered in the name of the company and need to be reviewed, which is quite troublesome. The SDK download found online even needs to be charged.
Official website: Mobile Security Alliance MSA
Support version
Manufacturer’s name | Support version |
---|---|
huawei | HMS 2.6.2 and above |
millet | MIUI 10.2 and later |
vivo | Android 9 or later |
OPPO | Color OS 7.0 and above |
Lenovo | Latest version 11.4 and later |
samsung | The Android version 10 |
meizu | The Android version 10 |
Nubian | The Android version 10 |
zte | The Android version 10 |
asus | The Android version 10 |
OnePlus | The Android version 10 |
Black shark | The Android version 10 |
MOTOROLA | The Android version 10 |
Freeme OS | The Android version 10 |
Begin to use
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 had a lot of problems, MSA is always improving the SDK, so be sure to use the latest version! I tested this version on Xiaomi on Android 11
Copy oaid_sdk_1.0.25.aar to the libs directory of the item and set the dependencies.
implementation files('libs/oaid_sdk_1. 0.25. The aar')
Copy the code
Copy supplierConfig. json to the project Assets directory and modify the edges, especially where you need to set the APPID. If you need to set the APPID, you need to register your app in the app store of the corresponding manufacturer. Note that the content of label does not need to be modified.
Core code, from the official demo to take
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 null, it can sleep for a few seconds
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(a) { tvContent.setText(ids); }}); }}Copy the code
Possible problems
The return of OAID is asynchronous, so sometimes it may not return after execution. In this case, the use of OAID may cause problems. It is recommended to null before use
alternative
There are two other alternatives recommended
Github.com/shuzilm-ope…
Github.com/gzu-liyujia…
APK download
Here is a compiled APK, which can be tested on the machine and passed the test on my Xiaomi phone with Android 11. You can install it without any permission. Pan.baidu.com/s/1vRYPJ5zS… Extraction code: 2GR9
Write in the last
If you have any questions, please point out in the comment area. We will continue to update with the new version of SDK. If you think this blog helps you, you may as well click a “like” and go.