我用的非华为手机,getToken返回0,但是onToken方法不能回调,同样的代码,在华为手机上时可以运行的。
log如下,求助解决方案
0 23:35:55.219 15636 15636 I HMSAgent: MainActivity(100)->PushApplication(53)->HMSAgent(231)->connect
10-10 23:35:55.219 15636 15636 I HMSAgent: start connect
10-10 23:35:55.220 15636 15636 D HMSAgent: PushApplication(53)->HMSAgent(232)->ApiClientMgr(325)->connect
10-10 23:35:55.220 15636 15636 D HMSAgent: client is invalid:size=0
10-10 23:35:55.220 15636 15636 D HMSAgent: HMSAgent(232)->ApiClientMgr(333)->ApiClientMgr(349)->startConnect
10-10 23:35:55.220 15636 15636 D HMSAgent: start thread to connect
10-10 23:35:55.222 15636 15776 D HMSAgent: ThreadPoolExecutor(588)->ThreadPoolExecutor(1113)->ApiClientMgr(356)->run
10-10 23:35:55.222 15636 15776 D HMSAgent: connect
10-10 23:35:55.222 15636 15636 D HMSAgent: Activity(1171)->Application(217)->ActivityMgr(180)->onActivityStarted
10-10 23:35:55.222 15636 15636 D HMSAgent: onStarted:com.teaui.calendar.module.MainActivity@1fdcfec
10-10 23:35:55.222 15636 15768 I [T1.0.0]AgnesTracker_sEvt: event:Expose,app:StarCalendar,widget:CanlExp,Send success.
10-10 23:35:55.223 15636 15776 I HMSSDK_HuaweiApiClientImpl: ====== HMSSDK version: 20601301 ======
10-10 23:35:55.223 15636 15636 D HMSAgent: Activity(1232)->Application(226)->ActivityMgr(190)->onActivityResumed
10-10 23:35:55.223 15636 15636 D HMSAgent: onResumed:com.teaui.calendar.module.MainActivity@1fdcfec
10-10 23:35:55.223 15636 15636 D HMSAgent: Application(226)->ActivityMgr(195)->ApiClientMgr(423)->onActivityResume
10-10 23:35:55.223 15636 15636 D HMSAgent: tell hmssdk: onResume
10-10 23:35:55.223 15636 15636 D HMSAgent: Application(226)->ActivityMgr(195)->ApiClientMgr(428)->onActivityResume
10-10 23:35:55.223 15636 15636 D HMSAgent: is resolving:false
10-10 23:35:55.935 15636 15636 D HMSAgent: HuaweiApiClientImpl(72)->HuaweiApiClientImpl(1031)->ApiClientMgr(507)->onConnected
10-10 23:35:55.935 15636 15636 D HMSAgent: connect success
10-10 23:35:55.935 15636 15636 D HMSAgent: HuaweiApiClientImpl(1031)->ApiClientMgr(509)->ApiClientMgr(375)->onConnectEnd
10-10 23:35:55.935 15636 15636 D HMSAgent: connect end:0
10-10 23:35:55.936 15636 15776 D HMSAgent: ThreadPoolExecutor(588)->ThreadPoolExecutor(1113)->ApiClientMgr(407)->run
10-10 23:35:55.936 15636 15776 D HMSAgent: callback connect: rst=0 apiClient=com.huawei.hms.api.HuaweiApiClientImpl@c31b9e5
10-10 23:35:55.951 15097 15110 I AIDLInvoke: Request, URI: core.getNoticeIntent, clientId: {appId: 100435213, hostAppID: 100435213, packageName: com.teaui.starcalendar, sdkVersion: 20601301}
10-10 23:35:55.952 15097 15110 I Jos.getNotice: [2018-10-10 23:35:55.951 I/HwJOS/Jos.getNotice 15097:286 :58] onRequest:0
10-10 23:35:55.955 15636 15636 I HMSAgent: PushApplication(56)->HMSAgent(257)->GetTokenApi(107)->getToken
10-10 23:35:55.955 15636 15636 I HMSAgent: getToken:handler=com.common.push.PushApplication$2$1@d30dcaa
10-10 23:35:55.957 15097 15110 W HwAccInfoCache: [2018-10-10 23:35:55.956 W/HwJOS/HwAccInfoCache 15097:286 :127] HwIDInnerService get ServiceTokenInfo failed.retCode:2902
10-10 23:35:55.958 15636 15636 D HMSAgent: HMSAgent(257)->GetTokenApi(110)->BaseApiAgent(9)->connect
10-10 23:35:55.958 15636 15636 D HMSAgent: connect
10-10 23:35:55.959 15636 15636 D HMSAgent: GetTokenApi(110)->BaseApiAgent(10)->ApiClientMgr(319)->connect
10-10 23:35:55.959 15636 15636 D HMSAgent: client is valid
10-10 23:35:55.960 15636 15776 D HMSAgent: ThreadPoolExecutor(588)->ThreadPoolExecutor(1113)->ApiClientMgr(407)->run
10-10 23:35:55.960 15636 15776 D HMSAgent: callback connect: rst=0 apiClient=com.huawei.hms.api.HuaweiApiClientImpl@c31b9e5
10-10 23:35:55.961 15636 15776 I HMSSDK_HuaweiPushApiImp: get token, pkgName:com.teaui.starcalendar
10-10 23:35:55.975 15097 15110 W Jos.getNotice: [2018-10-10 23:35:55.967 W/HwJOS/Jos.getNotice 15097:286 :110] onRequestStop statusCode:8001
10-10 23:35:55.980 15636 15717 I HMSSDK_connectservice: josNoticeResp status code :8001
10-10 23:35:55.991 1513 2727 D DisplayPowerController: requestPowerState: policy=BRIGHT, useProximitySensor=false, screenBrightness=1956, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, brightnessFromSetting=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, appSetBacklightDim = 0, dimRate = 75, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, waitForNegativeProximity=false
10-10 23:35:55.992 15636 15636 D HMSAgent: Activity(1641)->Application(244)->ActivityMgr(218)->onActivityStopped
10-10 23:35:55.992 15636 15636 D HMSAgent: onStopped:com.teaui.calendar.module.splash.SplashActivity@4d388d4
10-10 23:35:55.994 15636 15636 D HMSAgent: Activity(1708)->Application(263)->ActivityMgr(235)->onActivityDestroyed
10-10 23:35:55.994 15636 15636 D HMSAgent: onDestroyed:com.teaui.calendar.module.splash.SplashActivity@4d388d4
10-10 23:35:55.995 15097 15109 I AIDLInvoke: Request, URI: push.gettoken, clientId: {appId: 100435213, hostAppID: 100435213, packageName: com.teaui.starcalendar, sdkVersion: 20601301}
10-10 23:35:55.999 15097 15109 I GetTokenRequest: [2018-10-10 23:35:55.998 I/PushLog/GetTokenRequest 15097:285 :67] enter get token request:com.huawei.hms.support.api.entity.push.TokenReq {
10-10 23:35:55.999 15097 15109 I GetTokenRequest: pkgName: com.teaui.starcalendar
10-10 23:35:55.999 15097 15109 I GetTokenRequest: isFirstTime: false
10-10 23:35:55.999 15097 15109 I GetTokenRequest: }, send broadcast to pushagent.
10-10 23:35:55.999 15097 15109 D PushLog3201_HMS: [Binder_1-285]get EMUI version is:(:167)
10-10 23:35:55.999 15097 15109 W PushLog3201_HMS: [Binder_1-285]it is not EMUI system.(:167)
10-10 23:35:56.000 15097 15109 D PushLog3201_HMS: [Binder_1-285]existFrameworkPush:0(:167)
10-10 23:35:56.002 1513 2379 W PowerManagerService: LIMIT_APP: in WorkerRunnable call setUid = 10210
10-10 23:35:56.003 1513 2707 W PowerManagerService: LIMIT_APP: getNetworkBytes use time = 2
10-10 23:35:56.004 15097 15109 D PushLog3201_HMS: [Binder_1-285]PushProxy cost 4(:167)
10-10 23:35:56.005 15097 15170 D PushLog3201_HMS: [Thread-322-322]existFrameworkPush:0(:167)
10-10 23:35:56.005 15097 15109 I PushLog3201_HMS: [Binder_1-285]this package:com.teaui.starcalendar have already registered.(:167)
10-10 23:35:56.005 15097 15170 D PushLog3201_HMS: [Thread-322-322]getUserId:0(:167)
10-10 23:35:56.005 15097 15170 I PushLog3201_HMS: [Thread-322-322]Start HMS push service.(:167)
10-10 23:35:56.006 15097 15170 D PushLog3201_HMS: [Thread-322-322]enter checkBackUp()(:167)
10-10 23:35:56.006 15097 15170 D PushLog3201_HMS: [Thread-322-322]enter getCachedDeviceId()(:167)
10-10 23:35:56.011 15097 15170 D PushLog3201_HMS: [Thread-322-322]get EMUI version is:(:167)
10-10 23:35:56.011 15097 15170 W PushLog3201_HMS: [Thread-322-322]it is not EMUI system.(:167)
10-10 23:35:56.011 15097 15170 E PushLog3201_HMS: [Thread-322-322]device id is uuid, not support clone check(:167)
10-10 23:35:56.014 15178 15178 I PushLog3201_HMS: [main-1]PushService onStartCommand(:167)
10-10 23:35:56.014 15178 15178 D PushLog3201_HMS: [main-1]onStartCommand, intent is:#Intent;action=com.huawei.android.push.intent.REGISTER;launchFlags=0x20;package=com.huawei.hwid;component=com.huawei.hwid/com.huawei.hms.pushagent.PushService;B.is_hms=true;S.userid=0;S.pkg_name=com.teaui.starcalendar;end(:167)
10-10 23:35:56.014 15178 15178 D PushLog3201_HMS: [main-1]broadcastToProcess, intent is:com.huawei.android.push.intent.REGISTER(:167)
10-10 23:35:56.016 1513 2379 W PowerManagerService: LIMIT_APP: in WorkerRunnable call setUid = 10210
10-10 23:35:56.018 1513 2690 W PowerManagerService: LIMIT_APP: getNetworkBytes use time = 2
10-10 23:35:56.018 15178 15178 I PushLog3201_HMS: [main-1]dispatchIntent over(:167)
10-10 23:35:56.020 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]enter ConnectReceiver:onReceive(:167)
10-10 23:35:56.020 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]enter CommandReceiver:onReceive,Intent { act=com.huawei.android.push.intent.REGISTER flg=0x20 FromType=0xffffffff mCallingUid=10210 pkg=com.huawei.hwid cmp=com.huawei.hwid/com.huawei.hms.pushagent.PushService (has extras) }(:167)
10-10 23:35:56.020 15636 15774 I HMSSDK_GetTokenPendingResultImpl: get token complete, the return code:0
10-10 23:35:56.020 15178 15213 D PushLog3201_HMS: [ReceiverDispatcher-311]enter cancelAlarm(Intent=Intent { act=com.huawei.intent.action.PUSH_OFF FromType=0xffffffff pkg=com.huawei.hwid (has extras) }(:167)
10-10 23:35:56.020 15636 15636 D HMSAgent: PendingResultImpl(402)->GetTokenApi(56)->GetTokenApi(73)->onResult
10-10 23:35:56.020 15636 15636 D HMSAgent: status={statusCode: 0, statusMessage: null, pendingIntent: null, }
10-10 23:35:56.021 15636 15636 I HMSAgent: GetTokenApi(56)->GetTokenApi(80)->GetTokenApi(93)->onPushTokenResult
10-10 23:35:56.021 15636 15636 I HMSAgent: getToken:callback=com.common.push.PushApplication$2$1@d30dcaa retCode=0
10-10 23:35:56.021 15636 15636 D baishi : get token: end0
10-10 23:35:56.022 15636 15636 I HMSAgent: PushApplication(60)->HMSAgent(285)->EnableReceiveNotifyMsgApi(69)->enableReceiveNotifyMsg
10-10 23:35:56.022 15636 15636 I HMSAgent: enableReceiveNotifyMsg:enable=true handler=com.common.push.PushApplication$2$1$1@938dc38
10-10 23:35:56.022 15636 15636 D HMSAgent: HMSAgent(285)->EnableReceiveNotifyMsgApi(72)->BaseApiAgent(9)->connect
10-10 23:35:56.022 15636 15636 D HMSAgent: connect
10-10 23:35:56.022 1513 2647 I AlarmManager: remove operation, and pid = 15178
10-10 23:35:56.022 15636 15636 D HMSAgent: EnableReceiveNotifyMsgApi(72)->BaseApiAgent(10)->ApiClientMgr(319)->connect
10-10 23:35:56.022 15636 15636 D HMSAgent: client is valid
10-10 23:35:56.022 1513 2647 I AlarmManager: didRemove is false
10-10 23:35:56.022 15636 15776 D HMSAgent: ThreadPoolExecutor(588)->ThreadPoolExecutor(1113)->ApiClientMgr(407)->run
10-10 23:35:56.022 15636 15776 D HMSAgent: callback connect: rst=0 apiClient=com.huawei.hms.api.HuaweiApiClientImpl@c31b9e5
10-10 23:35:56.022 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]check push connection is exist, sendHeartBeat.(:167)
10-10 23:35:56.024 15178 15213 D PushLog3201_HMS: [ReceiverDispatcher-311]enter AlarmTools:setExactAlarm(intent:Intent { act=com.huawei.android.push.intent.HEARTBEAT_RSP_TIMEOUT FromType=0xffffffff pkg=com.huawei.hwid } interval:10000ms, context:com.huawei.hms.pushagent.PushService@91288ab(:167)
10-10 23:35:56.025 15636 15796 I HMSSDK_HuaweiPushApiImp: invoke enableReceiveNotifyMsg, set flag:true
10-10 23:35:56.025 1513 2648 I AlarmManager: set(PendingIntent{5cc1d97: PendingIntentRecord{8695345 com.huawei.hwid broadcastIntent key.isShadow:false}}) : type=0 triggerAtTime=1539185766025 win=0 tElapsed=62061415 maxElapsed=62061415 interval=0 flags=0x1
10-10 23:35:56.025 1513 2648 I AlarmManager: didRemove is false
10-10 23:35:56.026 1513 2648 I AlarmManager: set alarm to RTC 2 , when = 62061415, set_pid = 15178
10-10 23:35:56.026 1513 2648 E AlarmManagerService: 2s------> AlarmImplTimerFd::set: sec:62061,nsec:415000000,now_sec:5500(62051)
10-10 23:35:56.026 1513 2648 E AlarmManagerService: fail to open ramlog
10-10 23:35:56.026 1513 2648 I AlarmManager: can not set 3 as nextNonWakeup = 62055391, this pid = 15178
10-10 23:35:56.030 15097 15110 I AIDLInvoke: Request, URI: push.setNotifyFlag, clientId: {appId: 100435213, hostAppID: 100435213, packageName: com.teaui.starcalendar, sdkVersion: 20601301}
10-10 23:35:56.030 15097 15110 I EnableReceiveNotifyRequest: [2018-10-10 23:35:56.030 I/PushLog/EnableReceiveNotifyRequest 15097:286 :42] enter set self show message control flag, req:com.huawei.hms.support.api.entity.push.EnableNotifyReq {
10-10 23:35:56.030 15097 15110 I EnableReceiveNotifyRequest: pkgName: com.teaui.starcalendar
10-10 23:35:56.030 15097 15110 I EnableReceiveNotifyRequest: enable: true
10-10 23:35:56.030 15097 15110 I EnableReceiveNotifyRequest: }
10-10 23:35:56.032 15097 15110 D PushLog3201_HMS: [Binder_2-286]existFrameworkPush:0(:167)
10-10 23:35:56.035 15178 15178 D PushLog3201_HMS: [main-1]broadcast(),and mReceivers 4(:167)
10-10 23:35:56.035 15178 15178 D PushLog3201_HMS: [main-1]broadcastToProcess, intent is:com.huawei.intent.action.SELF_SHOW_FLAG(:167)
10-10 23:35:56.035 15178 15178 I PushLog3201_HMS: [main-1]dispatchIntent over(:167)
10-10 23:35:56.039 15636 15796 I HMSAgent: ThreadPoolExecutor(1113)->EnableReceiveNotifyMsgApi(50)->EnableReceiveNotifyMsgApi(57)->onEnableReceiveNotifyMsgResult
10-10 23:35:56.039 15636 15796 I HMSAgent: enableReceiveNotifyMsg:callback=com.common.push.PushApplication$2$1$1@938dc38 retCode=0
10-10 23:35:56.039 15636 15636 D baishi : enableReceiveNotifyMsg: end0
10-10 23:35:56.042 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]process cmdid to send to pushSrv:DA(:167)
10-10 23:35:56.043 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]send msg to remote srv success(:167)
10-10 23:35:56.043 15178 15213 D PushLog3201_HMS: [ReceiverDispatcher-311]enter ChannelStatusReceiver:onReceive(:167)
10-10 23:35:56.044 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]enter ConnectReceiver:onReceive(:167)
10-10 23:35:56.044 15178 15213 I PushLog3201_HMS: [ReceiverDispatcher-311]enter CommandReceiver:onReceive,Intent { act=com.huawei.intent.action.SELF_SHOW_FLAG flg=0x10 FromType=0xffffffff mCallingUid=10210 pkg=com.huawei.hwid (has extras) }(:167)
10-10 23:35:56.046 15178 15213 D PushLog3201_HMS: [ReceiverDispatcher-311]pkg:com.teaui.starcalendar,flag:true(:167)
10-10 23:35:56.051 15178 15213 D PushLog3201_HMS: [ReceiverDispatcher-311]enter ChannelStatusReceiver:onReceive(:167)