MixPush
MixPush copied to clipboard
华为获取pushtoken报错
hms get token failed com.huawei.hms.common.ApiException: 907122050: operation in MAIN thread prohibited https://developer.huawei.com/consumer/cn/doc/development/HMSCore-References-V5/error-code-0000001050255690-V5
提供一下,错误堆栈
getRegisterId这个方法
提供一下,错误堆栈
getRegisterId这个方法放在子线程中就OK了
getRegisterId 是Override 方法,现在是看到华为和荣耀的文档中明确提出需要在一个新线程中调用getToken
这样实现就没问题了 new Thread(() -> { // read from agconnect-services.json String appId = new AGConnectOptionsBuilder().build(context).getString("client/app_id"); try { regId = HmsInstanceId.getInstance(context).getToken(appId, "HCM"); } catch (ApiException e) { handler.getLogger().log(UnifiedHmsMessageService.TAG, "hms get token failed " + e.toString() + " https://developer.huawei.com/consumer/cn/doc/development/HMSCore-References-V5/error-code-0000001050255690-V5", e); e.printStackTrace(); } Log.e(UnifiedHmsMessageService.TAG, "get token:" + regId); }).start();
我也是这个样改了,荣耀只提供了 aar,Permission name PROCESS_PUSH_MSG is not unique
我也是这个样改了,荣耀只提供了 aar,Permission name PROCESS_PUSH_MSG is not unique
荣耀只能单独集成
奇怪,2.3.9 好用了,不用单独放在独立线程里了。