CometChat supports “Firebase” push notification. You can get more information about firebase from here.
You need to perform following steps to have the push notification in your app:
1. You have to create an account on firebase.google.com and create a project.
2. Once you have successfully created the project. Please create firebase iOS app by configuring bundle id in firebase project. Please refer below steps for the same.
Add Firebase for iOS app
1. Click on “Add Firebase to your iOS app” option.
2. Add Bundle id and app nickname of your app in popup window. Then click on “ADD APP” button located at bottom-below corner of popup window. After clicking on “ADD APP” button, GoogleService-Info.plist file will be downloaded on your machine. Complete steps by clicking on “CONTINUE” button in popup window.
3. Go to iOS app by clicking on “settings” option in more settings menu(Vertical dotted icon)
4. Select “CLOUD MESSAGING” tab in settings window. Upload .p12 Development and Distribution APNs certificate. Get “Server key” to configure for CometChat firebase push notification service.
3. Now configure firebase server key in CometChat by referring below steps:
– Go to CometChat Administration Panel -> Go to extensions tab -> Click on “Configure Extension(green icon)” option in front of “mobileapp” -> Add Firebase server key -> Click on “UPDATE SETTINGS” button
4. Now you need to configure your mobile app for getting push notification from the Firebase. You can refer steps for the same.
5. You need to subscribe to a channel from where you will get the push notification. You will get this channel from the response received in onMyInfoReceived() callback in custom ui of iOS SDK. In case of Ready ui, you will get channel from the response received in userinfo callback of loginWithURL method. The response of callbacks contains a key named as “push_channel”. This contains the push notification channel. Once you subscribe to this channel, you will start receiving push notifications for one-on-one chat.
6. For push notifications in chatroom, you will get “push_channel” in success callback of joinChatroom in Custom UI. In case of Ready UI, you will get “push_channel” from the response received in chatroominfo callback of loginWithURL method. Once you subscribe to this channel, you will start receiving push notifications for chatroom chat.
7. For push notifications in Announcement, you will get “push_an_channel” in response of onMyInfoReceived() callback in custom ui of iOS SDK respectively. In case of Ready ui, you will get “push_an_channel” from the response received in userinfo callback of loginWithURL method. Once you subscribe to this channel you will start receiving push notification for announcements sent from CometChat administration panel.
Not finding what you need?
The CometChat team is here to help!