当前位置: 首页 > 知识库问答 >
问题:

华为推送工具包:令牌在华为手机上返回空

尉迟宣
2023-03-14

在我getgettokentask接收一个空令牌的日志中,请检查hmsmessageService.onnewtoken接收结果。,但是onnewtoken中也没有给出令牌。

检索令牌的代码:

GlobalScope.launch(context = Dispatchers.IO) {
    try {
        val appId = AGConnectServicesConfig.fromContext(this@MainActivity).getString("client/app_id")
        val token = HmsInstanceId.getInstance(this@MainActivity).getToken(appId, "HCM")
        Pulp.debug("Huawei", "Token received") {
            "token" to token
        }
    } catch (e: java.lang.Exception) {
        Pulp.error("Huawei", "Failed to fetch token", e) {
            "Cause" to (e.message ?: "Empty")
        }
    }
}

结果也不例外。但是令牌是空的(请参见最后一行日志)。

override fun onNewToken(token: String?) {
    super.onNewToken(token)
    Pulp.debug("Huawei", "(onNewToken): Huawei messaging token received") {
        "Token" to (token ?: "NO token")
    }
}
2020-09-16 15:33:50.791 19954-19954/ir.malv.plusdependencytest I/HMSSDK_AutoInit: Push init start
2020-09-16 15:33:50.854 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HMSBIInitializer: Builder->biInitFlag :false
2020-09-16 15:33:50.856 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HMSBIInitializer: Builder->biSetting :false
2020-09-16 15:33:50.859 19954-19954/ir.malv.plusdependencytest I/HMSSDK_CountryCodeBean: getCountryCode get country code from SIM_COUNTRY
2020-09-16 15:33:50.863 19954-19954/ir.malv.plusdependencytest W/HMSSDK_CountryCodeBean: countryCode from system language is not reliable.
2020-09-16 15:33:50.864 19954-19954/ir.malv.plusdependencytest E/HMSSDK_HMSBIInitializer: Failed to get device issue country
2020-09-16 15:33:50.909 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HMSPackageManager: Succeed to find HMS apk: com.huawei.hwid version: 40100308
2020-09-16 15:33:50.934 19954-20000/ir.malv.plusdependencytest I/HMSSDK_HMSBIInitializer: Builder->biInitFlag :false
2020-09-16 15:33:50.936 19954-20000/ir.malv.plusdependencytest I/HMSSDK_HMSBIInitializer: Builder->biSetting :false
2020-09-16 15:33:50.936 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HMSBIInitializer: Builder->biInitFlag :false
2020-09-16 15:33:50.937 19954-20000/ir.malv.plusdependencytest I/HMSSDK_CountryCodeBean: getCountryCode get country code from SIM_COUNTRY
2020-09-16 15:33:50.938 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HMSBIInitializer: Builder->biSetting :false
2020-09-16 15:33:50.939 19954-20000/ir.malv.plusdependencytest W/HMSSDK_CountryCodeBean: countryCode from system language is not reliable.
2020-09-16 15:33:50.940 19954-20000/ir.malv.plusdependencytest E/HMSSDK_HMSBIInitializer: Failed to get device issue country
2020-09-16 15:33:50.953 19954-20000/ir.malv.plusdependencytest I/HMSSDK_HiAnalyticsUtils: issueCountry initial
2020-09-16 15:33:50.953 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HiAnalyticsUtils: issueCountry initial
2020-09-16 15:33:50.954 19954-20000/ir.malv.plusdependencytest I/HMSSDK_CountryCodeBean: getCountryCode get country code from SIM_COUNTRY
2020-09-16 15:33:50.954 19954-19954/ir.malv.plusdependencytest I/HMSSDK_CountryCodeBean: getCountryCode get country code from SIM_COUNTRY
2020-09-16 15:33:50.956 19954-19954/ir.malv.plusdependencytest W/HMSSDK_CountryCodeBean: countryCode from system language is not reliable.
2020-09-16 15:33:50.956 19954-20000/ir.malv.plusdependencytest W/HMSSDK_CountryCodeBean: countryCode from system language is not reliable.
2020-09-16 15:33:50.956 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HiAnalyticsUtils: not ChinaROM
2020-09-16 15:33:50.956 19954-20000/ir.malv.plusdependencytest I/HMSSDK_HiAnalyticsUtils: not ChinaROM
2020-09-16 15:33:50.959 19954-20000/ir.malv.plusdependencytest I/HMSSDK_HiAnalyticsUtils: hw_app_analytics_state value is 0
2020-09-16 15:33:50.959 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HiAnalyticsUtils: hw_app_analytics_state value is 0
2020-09-16 15:33:50.960 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HmsMessaging: invoke turnOnPush
2020-09-16 15:33:50.963 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HmsMessaging: turn on/off with AIDL
2020-09-16 15:33:50.970 19954-20004/ir.malv.plusdependencytest I/HMSSDK_HuaweiApiManager: sendRequest
2020-09-16 15:33:50.971 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: ====== HMSSDK version: 50000301 ======
2020-09-16 15:33:50.972 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: Enter connect, Connection Status: 1
2020-09-16 15:33:50.973 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: connect minVersion:30000000
2020-09-16 15:33:50.975 19954-20004/ir.malv.plusdependencytest I/HMSSDK_Util: available exist: true
2020-09-16 15:33:50.976 19954-20004/ir.malv.plusdependencytest E/HMSSDK_Util: In isAvailableLibExist, Failed to read meta data for the availableLoaded.
2020-09-16 15:33:50.977 19954-20004/ir.malv.plusdependencytest I/HMSSDK_Util: available exist: true
2020-09-16 15:33:50.981 19954-20004/ir.malv.plusdependencytest I/HMSSDK_HMSPackageManager: current versionCode:40100308, minimum version requirements: 30000000
2020-09-16 15:33:50.986 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: check available result: 0
2020-09-16 15:33:50.987 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: enter bindCoreService
2020-09-16 15:33:51.007 19954-20004/ir.malv.plusdependencytest I/HMSSDK_HuaweiApiManager: sendRequest
2020-09-16 15:33:51.008 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: ====== HMSSDK version: 50000301 ======
2020-09-16 15:33:51.009 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: Enter connect, Connection Status: 1
2020-09-16 15:33:51.010 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: connect minVersion:30000000
2020-09-16 15:33:51.010 19954-20004/ir.malv.plusdependencytest I/HMSSDK_Util: available exist: true
2020-09-16 15:33:51.013 19954-20004/ir.malv.plusdependencytest I/HMSSDK_HMSPackageManager: current versionCode:40100308, minimum version requirements: 30000000
2020-09-16 15:33:51.016 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: check available result: 0
2020-09-16 15:33:51.017 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: enter bindCoreService
2020-09-16 15:33:51.681 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BinderAdapter: Enter onServiceConnected.
2020-09-16 15:33:51.682 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: Enter onServiceConnected.
2020-09-16 15:33:51.684 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BinderAdapter: Enter onServiceConnected.
2020-09-16 15:33:51.684 19954-20004/ir.malv.plusdependencytest I/HMSSDK_HmsClient: post msg api_name:push.setNotifyFlag, app_id:102760085|, pkg_name:ir.malv.plusdependencytest, sdk_version:50000301, session_id:*, transaction_id:102760085fyFlag20200916153350948378003, kitSdkVersion:50002300, apiLevel:1
2020-09-16 15:33:51.685 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BaseHmsClient: Enter onServiceConnected.
2020-09-16 15:33:51.689 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseAdapter: in baseRequest + uri is :push.setNotifyFlag, transactionId is : 102760085fyFlag20200916153350948378003
2020-09-16 15:33:51.692 19954-20004/ir.malv.plusdependencytest I/HMSSDK_PendingResultImpl: init uri:push.setNotifyFlag
2020-09-16 15:33:51.694 19954-20004/ir.malv.plusdependencytest I/HMSSDK_PendingResultImpl: setResultCallback
2020-09-16 15:33:51.698 19954-20004/ir.malv.plusdependencytest I/HMSSDK_HmsClient: post msg api_name:push.gettoken, app_id:102760085|, pkg_name:ir.malv.plusdependencytest, sdk_version:50000301, session_id:*, transaction_id:102760085ttoken20200916153350948306787, kitSdkVersion:50002300, apiLevel:1
2020-09-16 15:33:51.706 19954-20004/ir.malv.plusdependencytest I/HMSSDK_BaseAdapter: in baseRequest + uri is :push.gettoken, transactionId is : 102760085ttoken20200916153350948306787
2020-09-16 15:33:51.708 19954-20004/ir.malv.plusdependencytest I/HMSSDK_PendingResultImpl: init uri:push.gettoken
2020-09-16 15:33:51.709 19954-20004/ir.malv.plusdependencytest I/HMSSDK_PendingResultImpl: setResultCallback
2020-09-16 15:33:51.720 19954-19972/ir.malv.plusdependencytest I/HMSSDK_PendingResultImpl: setResult:0
2020-09-16 15:33:51.745 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BaseAdapter: baseCallBack.onComplete
2020-09-16 15:33:51.746 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HmsClient: receive msg status_code:0, error_code0, api_name:push.setNotifyFlag, app_id:102760085|, pkg_name:ir.malv.plusdependencytest, session_id:*, transaction_id:102760085fyFlag20200916153350948378003, resolution:null
2020-09-16 15:33:51.748 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BaseVoidTask: Operate succeed
2020-09-16 15:33:51.771 19954-19972/ir.malv.plusdependencytest I/HMSSDK_PendingResultImpl: setResult:0
2020-09-16 15:33:51.837 19954-19954/ir.malv.plusdependencytest I/HMSSDK_BaseAdapter: baseCallBack.onComplete
2020-09-16 15:33:51.839 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HmsClient: receive msg status_code:0, error_code0, api_name:push.gettoken, app_id:102760085|, pkg_name:ir.malv.plusdependencytest, session_id:*, transaction_id:102760085ttoken20200916153350948306787, resolution:null
2020-09-16 15:33:51.842 19954-19954/ir.malv.plusdependencytest I/HMSSDK_HmsInstanceId: GetTokenTask receive a empty token, please check HmsMessageService.onNewToken receive result.
2020-09-16 20:15:10.585 7731-24998/? I/PushLog40100308_HMS: [Core-GWTask-84-859]enter set self show message control flag, req:{"enable":true,"packageName":"ir.malv.plusdependencytest"}(:289)
2020-09-16 20:15:10.586 7731-24998/? I/PushLog40100308_HMS: [Core-GWTask-84-859]init uri:pushcore.enableNotify(:289)
2020-09-16 20:15:10.586 7731-24998/? I/PushLog40100308_HMS: [Core-GWTask-84-859]await(:289)
2020-09-16 20:15:10.586 7731-24998/? I/PushLog40100308_HMS: [Core-GWTask-84-859]awaitOnAnyThread timeout:10 unit:SECONDS(:289)
2020-09-16 20:15:10.588 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Request, URI: pushcore.enableNotify, clientId: {packageName: com.huawei.hwid, sdkVersion: 10000000, originPackageName: ir.malv.plusdependencytest, originAppId: 102760085, originHostAppId: 102760085, originSdkVersion: 50000301}
2020-09-16 20:15:10.588 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]enter enable notify request:EnableNotifyReq{packageName='ir.malv.plusdependencytest', enable=true}
2020-09-16 20:15:10.590 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Response, uri: pushcore.enableNotify, statusCode: 0
2020-09-16 20:15:10.591 7731-24999/? I/PushLog40100308_HMS: [Core-GWTask-85-860]enter get token request:com.huawei.hms.support.api.entity.push.TokenReq{ pkgName: ir.malv.plusdependencytest isFirstTime: true scope: null appId: null} , transactionId:102760085ttoken20200916201509611018781(:289)
2020-09-16 20:15:10.592 7731-19020/? I/PushLog40100308_HMS: [Binder:7731_7-784]setResult:0(:289)
2020-09-16 20:15:10.592 7731-24999/? I/PushLog40100308_HMS: [Core-GWTask-85-860]init uri:pushcore.gettoken(:289)
2020-09-16 20:15:10.593 7731-24999/? I/PushLog40100308_HMS: [Core-GWTask-85-860]await(:289)
2020-09-16 20:15:10.593 7731-24999/? I/PushLog40100308_HMS: [Core-GWTask-85-860]awaitOnAnyThread timeout:10 unit:SECONDS(:289)
2020-09-16 20:15:10.595 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Request, URI: pushcore.gettoken, clientId: {packageName: com.huawei.hwid, sdkVersion: 10000000, originPackageName: ir.malv.plusdependencytest, originAppId: 102760085, originHostAppId: 102760085, originSdkVersion: 50000301}
2020-09-16 20:15:10.595 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]GetTokenRequest: com.huawei.android.pushagent.core.support.entity.TokenReq{ pkgName: ir.malv.plusdependencytest},userId:0,transactionId:102760085ttoken20200916201509611018781
2020-09-16 20:15:10.596 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]check push connection is not exist, reconnect it.
2020-09-16 20:15:10.599 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]dispatchIntent over
2020-09-16 20:15:10.599 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]TRS exceed valid time, so need to query TRS again
2020-09-16 20:15:10.600 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]com.huawei.action.CONNECT_PUSHSRV alarm trigger, expectTriggerTime:0, current trigger time:1600271110600
2020-09-16 20:15:10.602 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]connect srv: TRS is invalid, so need to query TRS
2020-09-16 20:15:10.604 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:10.613 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:10.613 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]begin to get token from pushSrv, pkgName : ir.malv.plusdependencytest, userId :00
2020-09-16 20:15:10.617 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]apply token: TRS is invalid, so need to query TRS
2020-09-16 20:15:10.624 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:10.630 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Response, uri: pushcore.gettoken, statusCode: 0
2020-09-16 20:15:10.632 7731-19020/? I/PushLog40100308_HMS: [Binder:7731_7-784]setResult:0(:289)
2020-09-16 20:15:10.636 7731-24999/? I/PushLog40100308_HMS: [Core-GWTask-85-860]request token for HMS from system push.(:289)
2020-09-16 20:15:10.640 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]request token for HMS by AIDL.(:289)
2020-09-16 20:15:10.641 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]init uri:pushcore.gettoken(:289)
2020-09-16 20:15:10.642 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]await(:289)
2020-09-16 20:15:10.642 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]awaitOnAnyThread timeout:10 unit:SECONDS(:289)
2020-09-16 20:15:10.644 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Request, URI: pushcore.gettoken, clientId: {packageName: com.huawei.hwid, sdkVersion: 10000000, originPackageName: ir.malv.plusdependencytest, originAppId: 102760085, originHostAppId: 102760085, originSdkVersion: 50000301}
2020-09-16 20:15:10.644 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]GetTokenRequest: com.huawei.android.pushagent.core.support.entity.TokenReq{ pkgName: com.huawei.hwid},userId:0,transactionId:102760085ttoken20200916201509611018781
2020-09-16 20:15:10.645 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]check push connection is not exist, reconnect it.
2020-09-16 20:15:10.647 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]dispatchIntent over
2020-09-16 20:15:10.647 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]TRS exceed valid time, so need to query TRS again
2020-09-16 20:15:10.648 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]com.huawei.action.CONNECT_PUSHSRV alarm trigger, expectTriggerTime:0, current trigger time:1600271110648
2020-09-16 20:15:10.653 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]connect srv: TRS is invalid, so need to query TRS
2020-09-16 20:15:10.657 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:10.657 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:10.664 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]begin to get token from pushSrv, pkgName : com.huawei.hwid, userId :00
2020-09-16 20:15:10.667 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]apply token: TRS is invalid, so need to query TRS
    Tags: [Huawei]
    Message: Succefully turned on Push
2020-09-16 20:15:10.675 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:10.678 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Response, uri: pushcore.gettoken, statusCode: 0
2020-09-16 20:15:10.679 7731-8371/? I/PushLog40100308_HMS: [Binder:7731_6-640]setResult:0(:289)
2020-09-16 20:15:23.427 7731-25033/? I/PushLog40100308_HMS: [Core-GWTask-86-862]enter get token request:com.huawei.hms.support.api.entity.push.TokenReq{ pkgName: ir.malv.plusdependencytest isFirstTime: false scope: null appId: null} , transactionId:102760085ttoken20200916201523364702182(:289)
2020-09-16 20:15:23.428 7731-25033/? I/PushLog40100308_HMS: [Core-GWTask-86-862]init uri:pushcore.gettoken(:289)
2020-09-16 20:15:23.429 7731-25033/? I/PushLog40100308_HMS: [Core-GWTask-86-862]await(:289)
2020-09-16 20:15:23.429 7731-25033/? I/PushLog40100308_HMS: [Core-GWTask-86-862]awaitOnAnyThread timeout:10 unit:SECONDS(:289)
2020-09-16 20:15:23.432 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Request, URI: pushcore.gettoken, clientId: {packageName: com.huawei.hwid, sdkVersion: 10000000, originPackageName: ir.malv.plusdependencytest, originAppId: 102760085, originHostAppId: 102760085, originSdkVersion: 50000301}
2020-09-16 20:15:23.433 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]GetTokenRequest: com.huawei.android.pushagent.core.support.entity.TokenReq{ pkgName: ir.malv.plusdependencytest},userId:0,transactionId:102760085ttoken20200916201523364702182
2020-09-16 20:15:23.433 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]check push connection is not exist, reconnect it.
2020-09-16 20:15:23.436 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]dispatchIntent over
2020-09-16 20:15:23.436 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]TRS exceed valid time, so need to query TRS again
2020-09-16 20:15:23.437 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]com.huawei.action.CONNECT_PUSHSRV alarm trigger, expectTriggerTime:0, current trigger time:1600271123437
2020-09-16 20:15:23.439 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]connect srv: TRS is invalid, so need to query TRS
2020-09-16 20:15:23.443 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:23.444 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:23.449 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]begin to get token from pushSrv, pkgName : ir.malv.plusdependencytest, userId :00
2020-09-16 20:15:23.453 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]apply token: TRS is invalid, so need to query TRS
2020-09-16 20:15:23.458 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:23.462 6359-25001/? I/PushLog100101302: [IO-pool-thread-35-1642]Response, uri: pushcore.gettoken, statusCode: 0
2020-09-16 20:15:23.462 7731-8371/? I/PushLog40100308_HMS: [Binder:7731_6-640]setResult:0(:289)
2020-09-16 20:15:23.465 7731-25033/? I/PushLog40100308_HMS: [Core-GWTask-86-862]request token for HMS from system push.(:289)
2020-09-16 20:15:23.465 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]request token for HMS by AIDL.(:289)
2020-09-16 20:15:23.466 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]init uri:pushcore.gettoken(:289)
2020-09-16 20:15:23.466 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]await(:289)
2020-09-16 20:15:23.466 7731-14337/? I/PushLog40100308_HMS: [Push-Task-1-717]awaitOnAnyThread timeout:10 unit:SECONDS(:289)
2020-09-16 20:15:23.469 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Request, URI: pushcore.gettoken, clientId: {packageName: com.huawei.hwid, sdkVersion: 10000000, originPackageName: ir.malv.plusdependencytest, originAppId: 102760085, originHostAppId: 102760085, originSdkVersion: 50000301}
2020-09-16 20:15:23.470 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]GetTokenRequest: com.huawei.android.pushagent.core.support.entity.TokenReq{ pkgName: com.huawei.hwid},userId:0,transactionId:102760085ttoken20200916201523364702182
2020-09-16 20:15:23.471 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]check push connection is not exist, reconnect it.
2020-09-16 20:15:23.474 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]dispatchIntent over
2020-09-16 20:15:23.474 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]TRS exceed valid time, so need to query TRS again
2020-09-16 20:15:23.476 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]com.huawei.action.CONNECT_PUSHSRV alarm trigger, expectTriggerTime:0, current trigger time:1600271123476
2020-09-16 20:15:23.480 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:23.481 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]connect srv: TRS is invalid, so need to query TRS
2020-09-16 20:15:23.487 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]begin to get token from pushSrv, pkgName : com.huawei.hwid, userId :00
2020-09-16 20:15:23.491 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]apply token: TRS is invalid, so need to query TRS
2020-09-16 20:15:23.492 6359-6417/? I/PushLog100101302: [ReceiverDispatcher-383]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:23.500 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Not allow to use push in this area, and not pass interval,result code: 26, belong id is -1, server ip is , region of TRS server is -1
2020-09-16 20:15:23.503 6359-25003/? I/PushLog100101302: [IO-pool-thread-36-1644]Response, uri: pushcore.gettoken, statusCode: 0
2020-09-16 20:15:23.504 7731-8371/? I/PushLog40100308_HMS: [Binder:7731_6-640]setResult:0(:289)

关于手机和应用程序的信息:

  • 手机:华为Y7P
  • Android系统:10
  • EMUI:10.1.0
  • agconnect:'com.huawei.agconnect:agcp:1.4.1.300'
  • 普希基特:“com.huawei.hms:push:5.0.2.300”
  • agconnect-core:“com.huawei.agconnect:agconnect-core:1.4.1.300”
  • 自动初始化:
<meta-data
     android:name="push_kit_auto_init_enabled"
     android:value="true" />
  • 英国皇家海军服务:
<service
    android:name=".services.HmsService"
    android:exported="false">
     <intent-filter>
         <action android:name="com.huawei.push.action.MESSAGING_EVENT" />
     </intent-filter>
</service>
    null
    null

共有1个答案

呼延升
2023-03-14

将自动push_kit_auto_init_enabled和手动检索方法getToken()混合在一起会导致问题。

我们有一个类似的问题,有时会收到代币,有时不会。它看起来非常随意,但作为一个基本规则,您要么使用这里描述的自动方法之一,要么坚持本节,该节描述了如何在完成所有配置后立即申请令牌(第1、2、3和4部分)。

在一个允许推送消息的国家,这应该可以解决任何其他有这个问题的人的问题。

 类似资料: