tencent cloud

All product documents
Chat
Last updated: 2024-09-10 15:08:08
iOS
Last updated: 2024-09-10 15:08:08
This article explains how to replace the incoming call ringtone of TUICallKit, dividing the ringtone into application ringtone and offline push ringtone.

Setting application ringtone

There are two ways to set the application ringtone: replace the ringtone audio, or call the Setting ringtone interface.

1. Replace Audio File

If you include the TUICallKit component through source code dependency, you can replace the audio files in the Resources\AudioFile folder to achieve the purpose of changing the ringtone:
File Name
Use
phone_dialing.mp3
Ringtone when initiating a call
phone_ringing.mp3
Ringtone when receiving a call

2. Call Ringtone Interface

You can also set the incoming call ringtone through the setCallingBell interface.
Swift
Objective-C
TUICallKit.createInstance().setCallingBell(filePath: " ")
[[TUICallKit createInstance] setCallingBell:@" "];

Set Mute Mode

If you do not need ringing, you can set the silent mode through enableMuteMode interface.
Swift
Objective-C
TUICallKit.createInstance().setCallingBell(enable: true)
[[TUICallKit createInstance] enableMuteMode: YES];

Set Offline Push Ringtone

VoIP push does not support custom push ringtones. APNs push can set the iOSSound field in offlinePushInfo's params when calling through the Call Interface, passing the audio filename as iOSSound.
Note:
Offline Push Sound Setting (only effective for iOS), to customize iOSSound, you first need to link the audio file into the Xcode Project, then set the audio filename (with extension) to iOSSound.
Ringtone duration should be less than 30s.
Objective-C
Swift

[[TUICallKit createInstance] call:@"mike's id" params:[self getCallParams] callMediaType:TUICallMediaTypeVideo];

- (TUICallParams *)getCallParams {
TUIOfflinePushInfo *offlinePushInfo = [self createOfflinePushInfo];
TUICallParams *callParams = [TUICallParams new];
callParams.offlinePushInfo = offlinePushInfo;
callParams.timeout = 30;
return callParams;
}

+ (TUIOfflinePushInfo *)createOfflinePushInfo {
TUIOfflinePushInfo *pushInfo = [TUIOfflinePushInfo new];
pushInfo.title = @"";
pushInfo.desc = TUICallingLocalize(@"TUICallKit.have.new.invitation");
pushInfo.iOSPushType = TUICallIOSOfflinePushTypeAPNs;
pushInfo.ignoreIOSBadge = NO;
pushInfo.iOSSound = @"phone_ringing.mp3";
pushInfo.AndroidSound = @"phone_ringing";
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be identical with that in the console.
// OPPO must set a ChannelID to receive push messages. This channelID needs to be the same as the console.
pushInfo.AndroidOPPOChannelID = @"tuikit";
// FCM channel ID, you need change PrivateConstants.java and set "fcmPushChannelId"
pushInfo.AndroidFCMChannelID = @"fcm_push_channel";
// VIVO message type: 0-push message, 1-System message(have a higher delivery rate)
pushInfo.AndroidVIVOClassification = 1;
// HuaWei message type: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835
pushInfo.AndroidHuaWeiCategory = @"IM";
return pushInfo;
}
let params = TUICallParams()
let pushInfo: TUIOfflinePushInfo = TUIOfflinePushInfo()
pushInfo.title = "TUICallKit"
pushInfo.desc = "TUICallKit.have.new.invitation"
pushInfo.iOSPushType = .apns
pushInfo.ignoreIOSBadge = false
pushInfo.iOSSound = "phone_ringing.mp3"
pushInfo.androidSound = "phone_ringing"
// For OPPO, you must set the `ChannelID` to receive push messages. The `ChannelID` must be identical with that in the console.
// OPPO must set a ChannelID to receive push messages. This channelID needs to be the same as the console.
pushInfo.androidOPPOChannelID = "tuikit"
// FCM channel ID, you need change PrivateConstants.java and set "fcmPushChannelId"
pushInfo.androidFCMChannelID = "fcm_push_channel"
// VIVO message type: 0-push message, 1-System message(have a higher delivery rate)
pushInfo.androidVIVOClassification = 1
// HuaWei message type: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835
pushInfo.androidHuaWeiCategory = "IM"
params.userData = "User Data"
params.timeout = 30
params.offlinePushInfo = pushInfo
TUICallKit.createInstance().call(userId: "123456", callMediaType: .audio, params: params) {

} fail: {
code, message in
}





Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon