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.
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
Log in to the ZEGOCLOUD Admin Console, select Projects > Project Management to go to your project's detailed page.
In the project management page, click the In-app Chat tab, find the Customized push resource area and click the Add button.
Fill in the required fields and click Continue.
The required fields are explained as follows:
Field | Description |
---|---|
Push Resource ID | The ID of the resource to push. You can customize this ID. |
APNs | |
Sound | The 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 ID | If your project supports Android 8.0 (API 26) or later, you need to create a channel to customize notification sounds. |
Sound | The name of the sound resource file, without the suffix, such as call_sound. |
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
:
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
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
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
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