Channel Developers

APNs Credentials settings are identical to iOS native sttings. Set by referring to Set up APNs credential of iOS.

Make sure you have installed Facebook’s PushNotificationiOS. If it is not installed, refer to the react-native-push-notification repository to install it and proceed with the following procedure.

Requests permission to use push notification.

JavaScript

Acquire the device token. And notify the Channel Talk that the PushToken has changed.

JavaScript

Notifies Channel Talk that the user has received a push notification.

JavaScript

To handle push notifications, Add the following guides to your iOS project.

The below guide below follows the React-native-official-guide.

AppDelegate.swift

Swift

1. AppDelegate.h

Adopts UNUserNotificationCenter. For example:

Objective-C

2. AppDelegate.m

Modify the AppDelegate implementation by referring to the following.

Objective-C

The example below handles Channel Talk push notifications when the app is in the background or terminated. Add it to AppDelegate.m.

Objective-C

If you want to open the message when entering the app through push notification, add the example below to the componentDidMount() method of App.js.

JavaScript

This extension helps you respond appropriately to the Channel Talk remote push notification, even when the app is background or terminated.

Channel Talk recommends that you add this Extension. If you do not add this, both follow-up texting and remote notification may arrive. Setting it up in your project through iOS Notification Extension document.

This section describes how to support system push notification on Android.

To use system push notification in Android API level 33(Tiramisu) or above, you need POST_NOTIFICATIONS permission.

Channel Talk Android SDK does not request permission. Your application should request it manually. See Android official documentation regarding notification.

  1. Configure Android project with Firebase setup guide.

  2. Download the google-service.json file and place it in the root directory of the app scope module.

  1. Navigate to Project Overview > Project settings.

  1. Navigate to Cloud Messaging tab and click Manage Service Accounts.

  1. Prior to creating a service account, create a role. Navigate to Roles.

  1. Click CREATE ROLE.

  1. Fill in details and click ADD PERMISSIONS.

  1. Create a role with cloudmessaging.messages.create permission. You can find it by keyword using filter. Make sure you are typing keywords to "Enter property name or value" field NOT "Filter permissions by role."

  1. Navigate back to service accounts page and click CREATE SERVICE ACCOUNT.

  1. Fill in details and click CREATE AND CONTINUE.

  1. Click Select a role.

  1. Select a role created at step 6.

  1. Navigate to Manage keys for the service account.

  1. Create a key by ADD KEY > Create new key with JSON format.

  1. Upload the key file to Channel Desk at Channel Settings > Security and Development > Mobile SDK Push > Android

Background & Quit state messages

To receive messages normally in Background / Quit state, you need to pay attention to the FCM handler registration order. Please check the official guide document.

Follow one of the two sections based on whether your project has Firebase imported.

If your project was not using Firebase, simply add dependency on plugin-android-fcm to your app-level build.gradle. The module will register Firebase Service automatically and process Firebase messages so that you have no more work to do.

Groovy

You should forward some information to the SDK to process push notifications using ChannelIO.receivePushNotification().

JavaScript

Then let SDK know when a Firebase message arrives.

JavaScript
JavaScript

To navigate user to the chat when they clicked a push notification add the following lines to the last line of componentDidMount in App.js.

JavaScript