华为推送套件:华为手机上的令牌返回空

2024-03-04

我最近在华为手机上尝试了我的应用程序。

问题是 PushKit 不返回令牌并且getToken结果为空。

在日志中我得到GetTokenTask receive a empty token, please check HmsMessageService.onNewToken receive result., but没有给出令牌onNewToken either.

检索令牌的代码:

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")
        }
    }
}

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

中的代码HMSService:

override fun onNewToken(token: String?) {
    super.onNewToken(token)
    Pulp.debug("Huawei", "(onNewToken): Huawei messaging token received") {
        "Token" to (token ?: "NO token")
    }
}

完整日志来自auto_init到令牌请求:

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.

带有标签的日志=pushlog:

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)


有关电话和应用程序的信息:

  • Phone: 华为Y7p
  • 安卓:10
  • EMUI: 10.1.0
  • AG连接:'com.huawei.agconnect:agcp:1.4.1.300'
  • 推送套件:"com.huawei.hms:push:5.0.2.300"
  • AGConnect-核心:"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>

一些杂项信息:

  • 相同的应用程序CAN获取HMS token三星G-A40 with HMS Core v5.0.0.304
  • 没有与 App Gallery 同步的帐户且设备是全新的
  • 地区(国家和 IP):Iran

要求提供的额外信息:

  • Galaxy A40 从 0 记录到发送上行链路 [Link] https://gist.github.com/mahdi-malv/b91e3913130bbd7ff651f8aa048ff710
  • Galaxy A40 日志PhoneHMS核心允许的权限Link https://gist.github.com/mahdi-malv/39d88c20e16860f771d0d93f8623b207

自动搅拌push_kit_auto_init_enabled和手动检索方法getToken()在一起就会产生问题。

我们遇到了类似的问题,有时会收到令牌,有时则不会。它看起来很随机,但作为基本规则,您应该使用所描述的自动方法之一here https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-client-dev-0000001050042041#EN-US_TOPIC_0000001050042041__section13546121751811或者你坚持this https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-client-dev-0000001050042041#EN-US_TOPIC_0000001050042041__section876955375919部分描述了如何在完成所有配置后立即申请令牌(part 1 https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-agc-0000001050170137, part 2 https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-integrating-sdk-0000001050040084, part 3 https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-cfg-manifest-0000001050042037 and part 4 https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-obfuscation-scripts-0000001050176973).

对于在允许推送消息的国家/地区遇到此问题的其他人来说,这应该可以解决问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

华为推送套件:华为手机上的令牌返回空 的相关文章

  • Realm 中的更新语句

    I have VisitingCardPOJO表格 我想更新单个条目说在哪里no 3 VisitingCardPOJO java public class VisitingCardPOJO extends RealmObject Prima
  • 使用 ActiveAndroid 库存储 HashMap

    我有一堂课 Table name Control public class Control extends Model Column private String name Column private Map
  • 如何在再次恢复应用程序时不重新加载webview?

    我做了一个网络视图应用程序 一切都运转良好 但是 当用户点击后退按钮并打开 恢复 应用程序时 它会重新加载 Web 视图 我该如何预防呢 MainActivity java public class MainActivity extends
  • Android模拟器中的互联网连接始终显示连接状态

    我尝试了多种方法来检查我的 Android 模拟器中的互联网连接 ConnectivityManager conMgr ConnectivityManager getSystemService Context CONNECTIVITY SE
  • 视图无法解析为类型

    这里的视图似乎有什么问题 我该如何解决它 错误 视图无法解析为类型 public void onItemClick AdapterView
  • Android版本App更新代码

    我读到如果我们想更新Google Play中的应用程序 版本代码应该高于以前的apk文件 我有一个版本代码为 20 且版本名称为 1 0 的应用程序 那么要更新app 应该如何增加版本号呢 应该增加10吗 或者仅仅 1 就足够了 即版本代码
  • Android 从 C++ 端播放原始音频

    我需要能够在 Android 系统的 C 端以自定义文件格式传输音频 我正在致力于移植自定义媒体播放器 并且需要能够打开自定义文件并从中传输音频 这很重要 因为我认为从性能角度来看将整个播放器移植到 JAVA 是不可行的 并且通过 JNI
  • 如何使用数据绑定将点击侦听器设置为 LinearLayout

    我目前正在尝试将点击侦听器设置为LinearLayout查看在 xml使用数据绑定的布局文件 我已经设法让它在其他视图上很好地工作 比如Button or TextView 但由于某种原因 它不能与LinearLayout 这是我尝试的基本
  • Android:文本淡入和淡出

    我已阅读此 stackoverflow 问题和答案 并尝试实现文本淡入和淡出 Android中如何让文字淡入淡出 https stackoverflow com questions 8627211 how to make text fade
  • 在 /dev/input/eventX 中写入事件需要哪些命令?

    我正在开发一个android需要将触摸事件发送到 dev input eventX 的应用程序 我知道C执行此类操作的代码结构如下 struct input event struct timeval time unsigned short
  • Android 辅助功能服务检测通知

    我试图让我的应用程序在显示通知时进行检测 我已在设置应用程序中启用它并且onServiceConnected确实接到电话 但是当我创建通知或通过 gmail 应用程序接收电子邮件时 什么也没有发生 onAccessibilityEvent没
  • Cordova + android:无法从应用程序打开拨号盘或邮件意图

    我有一个奇怪的问题 我无法从应用程序中打开带有预定义号码或邮件意图的拨号盘 我正在使用 netbeans 8 0 1 创建 cordova 应用程序 我的 Cordova 版本是 4 0 0 我按照步骤创建了一个应用程序 并选择了 Hell
  • 将 android 蓝牙客户端套接字连接到 ubuntu 服务器套接字时出现问题

    我正在编写一个 Android 应用程序 它应该通过蓝牙与服务器交换数据 服务器端位于运行 Ubuntu 的 PC 上 使用 bluez 库 用 C 或 C 编写 当我尝试连接到 PC 上的服务器套接字时 我的 Android 应用程序失败
  • 警报对话框中的 Webview 不显示内容

    我正在开发一个 Android 应用程序 我需要在网络视图和警报对话框上显示一个网站 该站点显示在网络视图中 但不显示在警报对话框中 到目前为止 这是我的代码 WebView WebView myWebView WebView v find
  • Android Gradle 问题 - Flutter / Dart

    我的 Gradle 同步有问题 我使用 IntelliJ 和 Android Studio 构建 Flutter Dart 应用程序 我添加了 2 个新的依赖项 现在 Gradle 出现了问题 在 Android Studio 中一切正常
  • 如何使用 Retrofit 解析嵌套 json....?

    我不知道该怎么办使用 Retrofit 解析 json 熟悉使用 Retrofit 解析简单的 json 但不熟悉解析嵌套Json using Retrofit 这是我的 Json 数据 current observation image
  • Android:canvas.drawBitmap() 方法无法正常工作

    我已经发布了两个与此相关的问题 请参考此自定义饼图 1 https stackoverflow com questions 28343600 customize pie chart in quarter shape at the botto
  • react-native android fontFamily 不生效

    问题一 我在index android js的欢迎样式中添加了fontFamily 但没有效果 fontFamily 真的可以在 Android 上使用吗 欢迎 字体大小 20 fontFamily roboto thin 文本对齐 居中
  • 如何模拟ARM处理器运行环境并加载Linux内核模块?

    我尝试加载我的vmlinux into gdb并使用 ARM 内核模拟器 但我不明白为什么我会得到Undefined target command sim 这是外壳输出 arm eabi gdb vmlinux GNU gdb GDB 7
  • Keystore getEntry 在 Android 9 上返回 NULL

    c我已对存储在 Android 密钥库中的登录密码进行了加密和解密 在 Android 9 上 我观察到应用程序在尝试解密密码时崩溃 我无法重现它 但拥有 Pixel 3 的用户是崩溃的设备之一 下面是我如何从密钥库解密密码 private

随机推荐