Skip to content
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

Open
xp8812 opened this issue Apr 24, 2024 · 5 comments
Open

荣耀获取OAID的逻辑优化,或者开放一个修改方法 #87

xp8812 opened this issue Apr 24, 2024 · 5 comments

Comments

@xp8812
Copy link

xp8812 commented Apr 24, 2024

1713939103242

荣耀开发者平台推广,老机型这边需要获取华为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;
 }

@xp8812 xp8812 closed this as completed Apr 24, 2024
@xp8812 xp8812 reopened this Apr 24, 2024
@xp8812 xp8812 changed the title 荣耀获取OAID的逻辑优化 荣耀获取OAID的逻辑优化,或者开放一个修改方法 Apr 24, 2024
@jin123d
Copy link

jin123d commented Apr 25, 2024

这个问题太坑爹了,我这边最后传了两个 oaid 让服务端去判断

@bxjxxyy
Copy link

bxjxxyy commented May 6, 2024

这个问题太坑爹了,我这边最后传了两个 oaid 让服务端去判断

请问你是如何使用这个项目获取两个oaid的?不是只能获取一个么?

@jin123d
Copy link

jin123d commented May 8, 2024

这个问题太坑爹了,我这边最后传了两个 oaid 让服务端去判断

请问你是如何使用这个项目获取两个oaid的?不是只能获取一个么?

回退到老版本,然后自己接一下荣耀的 OAID 的SDK,这样华为和荣耀都能获取了,不然真不知道广告那边需要哪个 OAID

@bxjxxyy
Copy link

bxjxxyy commented May 8, 2024

这个问题太坑爹了,我这边最后传了两个 oaid 让服务端去判断

请问你是如何使用这个项目获取两个oaid的?不是只能获取一个么?

回退到老版本,然后自己接一下荣耀的 OAID 的SDK,这样华为和荣耀都能获取了,不然真不知道广告那边需要哪个 OAID

退回4.2.7我不确定是在新机上是如何表现的,新机上面DeviceID.getOAID是会进onOAIDGetError么?在onOAIDGetError里面判断是荣耀再用荣耀sdk获取荣耀id?

@bxxasn
Copy link

bxxasn commented May 14, 2024

怎么操作?

这个问题太坑爹了,我这边最后传了两个 oaid 让服务端去判断

请问你是如何使用这个项目获取两个oaid的?不是只能获取一个么?

回退到老版本,然后自己接一下荣耀的 OAID 的SDK,这样华为和荣耀都能获取了,不然真不知道广告那边需要哪个 OAID

退回4.2.7我不确定是在新机上是如何表现的,新机上面DeviceID.getOAID是会进onOAIDGetError么?在onOAIDGetError里面判断是荣耀再用荣耀sdk获取荣耀id?

同问,怎么操作?
apk启动后,第一次获取到的oaid跟第二次获取到的oaid不一致...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants