How can I implement Push notification in my app using CometChat SDK?

CometChat supports “Parse” push notification. You can get more information about parse from here.

You need to perform following steps to have the push notification in your app:

1. You have to create an account on parse.com and create an app.

2. Once you have successfully created the app get the Application ID, Client Key, REST API Key.

3. Now you need to perform the following changes on server side:
  – Go to path CometChat directory/extensions/mobileapp/ and open the file config.php
  – Replace the values for the variables PARSE_APP_ID and PARSE_REST_KEY in that file and save the file.
Once this id done, your server setup is ready.

4. Now you need to configure your mobile app for getting push notification from the Parse, to do so follow the sample app provided by the parse. You can also refer steps for Android app, and steps for iOS app.

5. As per the sample app of Parse, you need Application ID, Client Key and the channel. Use the above keys from parse app.

6. 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 gotProfileInfo() / onMyInfoReceived() callback in Android and iOS SDK respectively. 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.

7. For push notifications in chatroom, you will get “push_channel” in success callback of joinChatroom. Once you subscribe to this channel you will start receiving push notifications for chatroom chat.

8. For push notifications for Announcement, you will get “push_an_channel” in response of gotProfileInfo() / onMyInfoReceived() callback in Android and iOS SDK respectively. 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!