Skip to content

Commit

Permalink
Merge pull request #258 from onerain88/fix/push-huawei-token
Browse files Browse the repository at this point in the history
修复 Push 上传无效记录的 bug
  • Loading branch information
onerain88 committed Aug 17, 2023
2 parents eb31625 + 006bbcd commit fa73940
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 fa73940

Please sign in to comment.