Notification is not coming

When we send messages and initiate calls or receive calls then any notification is not coming. we are also upgrade the extension v1 & v2, and we are also sending the firebase token as well
implementation ‘com.cometchat:pro-android-chat-sdk:3.0.4’
implementation ‘com.cometchat:pro-android-calls-sdk:2.1.0’

 Log.d(TAG, "Initialization completed successfully")
            CometChat.login(UID, apiKey, object : CometChat.CallbackListener<User>() {
                override fun onSuccess(user: User) {
                    Log.d(TAG, "Login Successful : $user")
                    val messagesRequest =
                        MessagesRequestBuilder().setUID(receiverID!!).setLimit(50).build()
                    messagesRequest.fetchPrevious(object :
                        CometChat.CallbackListener<List<BaseMessage>>() {
                        override fun onSuccess(list: List<BaseMessage>) {
                            token = MyFirebaseMessagingService.token
                            Log.e("token", token.toString())
                            if (MyFirebaseMessagingService.token==null) {
                                FirebaseMessaging.getInstance().token.addOnCompleteListener {
                                    if(it.isComplete){
                                        token = it.result.toString()
                                        id?.let { it1 -> registerPushNotification(it1,token) };
                                   }
                                }
                            }else id?.let { registerPushNotification(it,token) };

rivate fun registerPushNotification(uid: String, token: String) {
Log.e(TAG, “onComplete: $token”)
CometChat.registerTokenForPushNotification(
token,
object : CometChat.CallbackListener<String?>() {
override fun onSuccess(s: String?) {
Toast.makeText(this@NewChatActivity, s, Toast.LENGTH_LONG).show()
Log.e("onSuccessPN: ", s!!)
}

            override fun onError(e: CometChatException) {
                Log.e("onErrorPN: ", e.message!!)
                Toast.makeText(this@NewChatActivity, e.message, Toast.LENGTH_SHORT).show()
            }
        })
    val str = uid + "_progressbar"
    val id = resources.getIdentifier(str, "id", packageName)}

Hello,

Please confirm if MyFirebaseMessagingService is implemented correctly and also check if onMessageReceived() is getting triggered whenever you a send a message from another device.

We suggest you to please check below documentation link for reference.
https://www.cometchat.com/docs/extensions/android-push-notifications

2 Likes

Hi @karishmaBh8178 Hope you are doing well.

Hope this was helpful! I am closing out this ticket due to inactivity. Please feel free to write to us at help@cometchat.com if you require any further assistance.

Regards,
Aishwarya

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.