Closed silviamirandastorm closed 1 year ago
Could you provide the full listener, its hard to tell what you are doing. The inbox listener only is called when the inbox message list is updated. It has no unreadMessage method.
Are you still having issue with this?
It doesn't work for me too. I tried with your own android repository and the listener in MainActivity doesn't work. I also tried in my own project and it didn't work. I am using "16.5.1"
@tarekatevenly could you provide more details and a snippet of how you are using it?
` I used this code snippet
override fun onResume() {
super.onResume()
viewModel.load()
MessageCenter.shared().inbox.addListener(airshipListener)
}
override fun onStop() {
MessageCenter.shared().inbox.removeListener(airshipListener)
super.onStop()
}
private val airshipListener = InboxListener {
setMessageCenterIndicator()
}
`
You probably want to add that listener during airship onReady instead of ti being tied to your activity. That way you can deeplink into the right place even if its not setup right.
Hi guys, We have a problem in android implementation (lib version 16.6.1) We instantiate the listener but it seems that it is not being listened
example of adding listener ->> MessageCenter.shared().inbox.addListener(inboxListener)
Part of previous code for context
private val inboxListener = InboxListener { unreadMessages { ……. } } ...
fun unreadMessages(callback: (unread: Int) -> Unit) { CoroutineScope(Dispatchers.Main).launch { val unreadCount = MessageCenter.shared().inbox.unreadCount callback.invoke(unreadCount) } }
…
I can only fetch the unread messages by calling directly —>> unreadMessages { countUnreadMessages-> ….. }
Something else must be done to addListener???