Android Classic chat SDK. Push notifications do not come | Community
Skip to main content

Android Classic chat SDK. Push notifications do not come

  • June 5, 2024
  • 1 reply
  • 0 views

Roman15

Hello! 

 

I'm using classic chat sdk zendesk-chat = { module = "com.zendesk:chat", version = "3.4.0" }

 

I initialise the SDK like this:

fun init() {
    Chat.INSTANCE.init(applicationContext, accountKey)

    val jwtAuthenticator = JwtAuthenticator { jwtCompletion ->
        jwtCompletion.onTokenLoaded(userJwtToken) // I get userJwtToken from our server
    }
    Chat.INSTANCE.setIdentity(jwtAuthenticator) { retrievePushTokenFromFirebase() }
}

fun retrievePushTokenFromFirebase() {

    val pushProvider: PushNotificationsProvider =
        Chat.INSTANCE.providers()?.pushNotificationsProvider()

    FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
        if (task.isSuccessful) {
             pushProvider?.registerPushToken(task.result)
        }
    }
}

When a user logs in to the app and start a chat, the chat works well, but if the user closes MessagingActivity or switch an application, pushes do not come. I can see it in app's logs that there come a message (not push) and the chat state is INITIALIZING. No pushes come to my implementation of FirebaseMessagingService at this moment. 

After the application is restarted, by the user or because being killed by the system, pushes start to come and work perfectly well.

 

I think there is a bug on the SDK side.

1 reply

Greg29
  • June 10, 2024
Hi Roman! I'm not terribly familiar with Firebase and the Android SDKs in general, however I do know that we recently required a change to ensure that push notifications via Firebase came through correctly. Would you mind taking a look at this article and let me know if the issue persists after these steps are followed?