logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

Custom notification sound


Introduction

By default, the In-app Chat uses the system sounds and vibrations for delivering notifications, while it also supports customizing notification sounds.

Note

This document is applicable to the project integrated with APNs or Google FCM (Android).

Common Usage

To customize the notification sound, you must package the sound resource file into the app, and configure the file path of the sound resource in the ZEGOCLOUD Admin Console.

Add sound resource files to the local project.

Get Push Resource ID in ZEGOCLOUD Admin Console

1
Go to your project's detailed page

Log in to the ZEGOCLOUD Admin Console, select Projects > Project Management to go to your project's detailed page.

2
Click add resources button

In the project management page, click the In-app Chat tab, find the Customized push resource area and click the Add button.

3
Fill in the required fields

Fill in the required fields and click Continue.

The required fields are explained as follows:

FieldDescription
Push Resource IDThe ID of the resource to push. You can customize this ID.
APNs
SoundThe path of the sound resource file in your app's IPA package. For example, if you opened your project in Xcode and imported the sound resource into the project in Build Phrases & Copy Bundle Resources, then the sound resource is already in the root directory with "sound resource name + file format", like callSound.caf.
FCM
Chanel IDIf your project supports Android 8.0 (API 26) or later, you need to create a channel to customize notification sounds.
SoundThe name of the sound resource file, without the suffix, such as call_sound.
4
Copy the Push Resource ID

After filling in all fields, a newly added entry shows like this, and you will need to copy the Push Resource ID.

Use the customized notification sound

Fill in the previously copied Push Resource ID in ZIMPushConfig:

iOS - objective-C
Android - Java
Flutter - Dart
React Native - JavaScript
  ZIMPushConfig *pushConfig = [[ZIMPushConfig alloc] init];
  pushConfig.resourcesID = @"push_resources_soundlimit";    // Push Resource ID copied from ZEGOCLOUD Admin Console
  pushConfig.title = @"your title";
  pushConfig.content = @"your content";

  // Call API including pushConfig
1
Copied!
  ZIMPushConfig pushConfig = new ZIMPushConfig();
  pushConfig.title = "your title";
  pushConfig.content = "your content";
  pushConfig.resourcesID = "push_resources_soundlimit";    // Push Resource ID copied from ZEGOCLOUD Admin Console

  // Call API including pushConfig
1
Copied!
  ZIMPushConfig pushConfig = ZIMPushConfig();
  pushConfig.resourcesID = "push_resources_soundlimit";    // Push Resource ID copied from ZEGOCLOUD Admin Console
  pushConfig.title = "your title";
  pushConfig.content = "your content";

  // Call API including pushConfig
1
Copied!
  var pushConfig = {
      resourcesID: "push_resources_soundlimit",    // Push Resource ID copied from ZEGOCLOUD Admin Console
      title: "your title",
      content: "your content"
  };
  var sendConfig = {
      priority: 2,
      pushConfig: pushConfig
  };

  // Call API including pushConfig
1
Copied!

Previous

Integrate FCM

Next

ResourcesID introduction