Skip to content

Commit

Permalink
fix: get regid from old huawei
Browse files Browse the repository at this point in the history
  • Loading branch information
leancloud-bot committed Aug 16, 2023
1 parent 1b1ac95 commit 006bbcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public static void putMetaString(@NonNull Context context, String key, String va
}

public static void sendDeviceInfo(String vendor, String regId) {
if (Utils.isNullOrEmpty(regId)) {
return;
}
Map<String, Object> deviceInfo = new HashMap<>();
deviceInfo.put("deviceType", "android");
deviceInfo.put("vendor", vendor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void run() {
String appId = AGConnectServicesConfig.fromContext(UnityPlayer.currentActivity).getString("client/app_id");
Log.i(Utils.TAG, "app id: " + appId);
String regId = HmsInstanceId.getInstance(UnityPlayer.currentActivity).getToken(appId, HmsMessaging.DEFAULT_TOKEN_SCOPE);
Log.i(Utils.TAG, "reg id: " + regId);
Utils.sendDeviceInfo("HMS", regId);

HmsMessaging.getInstance(UnityPlayer.currentActivity).turnOnPush().addOnCompleteListener(new OnCompleteListener<Void>() {
Expand Down

0 comments on commit 006bbcd

Please sign in to comment.