helpcrunch / android-sdk-demo

Public demo for HelpCrunch Android SDK
Apache License 2.0
9 stars 1 forks source link

Crash when using notifications and unread message counter #55

Closed mynormeza closed 2 years ago

mynormeza commented 2 years ago

I have added the code for notifications and unread message counter, the counter works when entering the activity/fragment, but if a message is received afterwards, the app crashes and shows this message

Screen Shot 2022-02-11 at 16 57 24

The same message appears when HelpCrunch.showNotification(remoteMessage) is called.

This is literary the code I am using

class NotificationsService : FirebaseMessagingService() {
.....
  override fun onMessageReceived(remoteMessage: RemoteMessage) {
....
       else if (remoteMessage.isHelpCrunchMessage()) {
            HelpCrunch.showNotification(remoteMessage)
        }
  }
}
HelpCrunch.getUnreadChatsCount(object : Callback<Int>() {
            override fun onSuccess(result: Int) {
                Toast.makeText(requireContext(),"Test Count: $result",Toast.LENGTH_SHORT).show()
                //handle result
            }

            override fun onError(message: String) {
                //handle error
            }
        })
TalbotGooday commented 2 years ago

Thanks for the reporting. Please tell me version of android does this problem occur on?

mynormeza commented 2 years ago

Thanks for the reporting. Please tell me version of android does this problem occur on?

Yes, it's android 11

TalbotGooday commented 2 years ago

Okay, got you. I'll let you know if will be able to reproduce

TalbotGooday commented 2 years ago

Found and fixed. New SDK version will be released next week