







V2 to start using the token-based version of the Push Notification extension.V1 and want to migrate your app to use V2, then Select V1 & V2 option. This ensures that the users viewing the older version of your app also receive Push Notifications.V2, thus turning off V1 (Topic-based) Push Notifications completely.

CometChat.registerTokenForPushNotification() function call. (You can see the process of getting the FCM Token in the next step)
| Files | Description |
|---|---|
| CallConnectionService.java | Custom ConnectionService file which is used to handle incoming & outgoing calls. It is used to manages the ConnectionService with your app. It also handles PhoneAccounts and bind it’s services to Telecom. |
| CallConnection.java | Custom Connection class which is used to handle the callbacks of ConnectionService. Call backs such as onAnswer(), onReject(), onHold(), etc. |
| CallManager.java | It is used to manages the ConnectionService with your app. It also handles PhoneAccounts and bind it’s services to Telecom. |
onNewToken() method. This token is stored as a String variable. You can choose to store it in SharedPreferences as well.CometChatHelper.processMessage() to convert the message JSON to the corresponding object of TextMessage, MediaMessage, CustomMessage, Action or Call.
This code needs to be added to the onMessageReceived() method of the FirebaseMessagingService class.
CometChatConstants.MESSAGE_TYPE_IMAGECometChatConstants.MESSAGE_TYPE_VIDEOCometChatConstants.MESSAGE_TYPE_AUDIOCometChatConstants.MESSAGE_TYPE_FILE