huawei push kit: getToken return unknown error code

Viewed 111

When I try to get use getToken method, it return the 907122050 error code, what is that mean?

    try {
      token = HmsInstanceId.getInstance(context).getToken(appId, defaultScope);
    } catch (ApiException e) {
      CoreLogger.e("getToken error: " + e.getStatusCode());
    }
1 Answers

According to Docs.

HMS Core Push SDK Result Codes

Result Codes 907122050 indicates the operation cannot be performed in the main thread. The method needs to be created in the subthread.

Solution: Need to Create a thread and call a specific method in the new thread.

Related