Android平台QuickBlox回调失效求助:CallService无法接收会话回调
Hey there, let's dig into why your CallService callbacks aren't firing. Looking at your code, I spotted a key issue that's likely causing this:
The Core Problem
In your initQBRTCClient() method, you're adding WebRtcSessionManager.getInstance(this) as the session callbacks listener instead of the CallService itself. Since your CallService implements QBRTCClientSessionCallbacks and QBRTCSessionConnectionCallbacks, but isn't registered as a listener, those callback methods in CallService will never get triggered.
Fix the Listener Registration
Update this line in initQBRTCClient():
rtcClient.addSessionCallbacksListener(WebRtcSessionManager.getInstance(this));
To:
rtcClient.addSessionCallbacksListener(this);
Additional Checks to Ensure Success
Let's confirm a few other setup details to rule out edge cases:
- QBSettings Initialization: The
QBSettingssetup code inonCreate()is commented out. Make sure this is properly initialized elsewhere in your app before starting the CallService (without this, chat and RTC functionality won't work). - Chat Login Success: Check the
onSuccesslog inloginToChat()to verify the chat login completes successfully. If login fails, the RTC client won't be initialized properly. - Push Notification Data: Ensure the push notification's
messageparameter is correctly passed, so the code triggeringCallService.start()actually runs. - Debug Logs: Since
QBRTCConfig.setDebugEnabled(true)is enabled, check for detailed RTC-related logs in Logcat after fixing the listener — these can help identify if there are still connection or signaling issues.
Once you update the listener registration, your onReceiveNewSession() and other callback methods should start receiving events and logging those Log.d(TAG, ""+1); lines as expected.
内容的提问来源于stack exchange,提问作者T Quick

