-
-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
荣耀获取OAID的逻辑优化,或者开放一个修改方法 #87
Comments
这个问题太坑爹了,我这边最后传了两个 oaid 让服务端去判断 |
请问你是如何使用这个项目获取两个oaid的?不是只能获取一个么? |
回退到老版本,然后自己接一下荣耀的 OAID 的SDK,这样华为和荣耀都能获取了,不然真不知道广告那边需要哪个 OAID |
退回4.2.7我不确定是在新机上是如何表现的,新机上面DeviceID.getOAID是会进onOAIDGetError么?在onOAIDGetError里面判断是荣耀再用荣耀sdk获取荣耀id? |
怎么操作?
同问,怎么操作? |
荣耀开发者平台推广,老机型这边需要获取华为oaid来去匹配 新机型获取荣耀oaid,希望作者能在下个版本判断一下
判断荣耀设备是否是新设备
使用场景
开发者可以读取设备ro.build.version.emui属性值来判断当前设备是否属于新设备(新荣耀产品,无
HMS 预装)
public static boolean isHonorNewDevice() {
if (isHonorDevice() && !isHonorOldDevice()) {
return true; // 新荣耀产品(无 HMS 预装)
}
return false; //21 年-23 年荣耀产品(有 HMS 预装)
}
private static boolean isHonorDevice() {
return Build.MANUFACTURER.equalsIgnoreCase("HONOR");
}
public static boolean isHonorOldDevice() {
String isEmotionOs = getBuildVersion("ro.build.version.emui");
if (!TextUtils.isEmpty(isEmotionOs)) {
return true;
}
return false;
}
public static String getBuildVersion(String key) {
String buildVersion = "";
try {
Class<?> clazz = Class.forName("android.os.SystemProperties");
Method method = clazz.getDeclaredMethod("get", String.class);
buildVersion = (String) method.invoke(clazz, key);
} catch (ClassNotFoundException e) {
Log.e("HONOR", "getBuildVersion ClassNotFoundException" +
e.getMessage());
} catch (NoSuchMethodException e) {
Log.e("HONOR", "getBuildVersion NoSuchMethodException" +
e.getMessage());
} catch (IllegalAccessException e) {
Log.e("HONOR", "getBuildVersion IllegalAccessException" +
e.getMessage());
} catch (InvocationTargetException e) {
Log.e("HONOR", "getBuildVersion InvocationTargetException" +
e.getMessage());
} catch (Exception e) {
Log.e("HONOR", "getBuildVersion Exception" + e.getMessage());
}
Log.i("HONOR", "getBuildVersion: " + buildVersion);
return buildVersion;
}
The text was updated successfully, but these errors were encountered: