Closed Yaya-Dev-Box closed 1 year ago
Hello @Yaya-Dev-Box Now we are working to resolve the issue and give you an answer. Please wait for a new release Android SDK.
@kirillTolmachev That's great, thanks.
I will be waiting.
@Yaya-Dev-Box The Android SDK side was fixed but we need to do some improvements in our chat server. Now you can update your Android SDK to version 4.0.1 and wait for an update from the chat server side.
@kirillTolmachev That's great, thank you.
Hello @Yaya-Dev-Box We have released a server patch to our shared server. If you have a dedicated instance please contact with our support team for updating.
Hi @kirillTolmachev, thanks for the update.
Are there any steps I need to make in order for the new change to take effect? I have already updated the SDK to use version "4.0.3", and also enabled "carbons" inside the sample-videochat-kotlin
Are there any other steps I'm missing? also, in what manner will the SDK be relaying user hangups/accepts with this new change?
Hi @Yaya-Dev-Box
For correct work logic of multi-devices, you need to add logic with enable carbon. Inside the sample-videochat-kotlin in LoginService need to update method fun loginToChat(qbUser: QBUser). Before login to chat add ConnectionListener
private fun loginToChat(qbUser: QBUser) {
QBChatService.getInstance().addConnectionListener(object : AbstractConnectionListener() {
override fun authenticated(connection: XMPPConnection, resumed: Boolean) {
try {
CarbonManager.getInstanceFor(connection).sendCarbonsEnabled(true)
} catch (e: NotConnectedException) {
// handle error
}
}
})
chatService.login(qbUser, object : QBEntityCallback<QBUser> {
override fun onSuccess(qbUser: QBUser?, bundle: Bundle) {
Log.d(TAG, "login onSuccess")
startActionsOnSuccessLogin()
}
override fun onError(e: QBResponseException) {
Log.d(TAG, "login onError " + e.message)
val errorMessage = if (e.message != null) {
e.message
} else {
"Login error"
}
sendResultToActivity(false, errorMessage)
}
})
}
For correct work, the application needs to update several methods fun onCallAcceptByUser() and fun onCallRejectByUser() in CallActivity.
private fun checkAndFinishMultiDeviceCall(userId: Int?) {
// here we check that call was accepted or rejected from another device
val currentUserId = QBChatService.getInstance().user.id
if (currentUserId == userId) {
WebRtcSessionManager.setCurrentSession(null)
callService.stopForeground(true)
finish()
}
}
override fun onCallAcceptByUser(session: QBRTCSession?, userId: Int?, map: MutableMap<String, String>?) {
if (callService.isCurrentSession(session)) {
callService.stopRingtone()
}
checkAndFinishMultiDeviceCall(userId)
}
override fun onCallRejectByUser(session: QBRTCSession?, userId: Int?, map: MutableMap<String, String>?) {
if (callService.isCurrentSession(session)) {
callService.stopRingtone()
}
checkAndFinishMultiDeviceCall(userId)
}
Works like a charm.
Thank you both @kirillTolmachev and @vdovbnya-qb , this issue is resolved now, feel free to close it.
@Yaya-Dev-Box Thank you for your feedback. The issue is closed.
Problem:
Hello, this is basically a copy of this iOS issue, but for Android, the linked issue's solution mentions using Apple's CallKit to notify users with multiple devices that one of their devices has answered/rejected the call, but I can't seem to find a similar solution for Android.
How to reproduce:
Expected behavior:
User B's second device should stop ringing when user B's first device accepts/rejects the call.
Question:
My question is: what is the Android equivalent of the iOS solution to produce the expected behavior?
Thanks