Effect when the screen is locked | Effect in the background |
![]() | ![]() |
target 'YourAppName' do# Uncommment the next line if you're using Swift or would like to use dynamic frameworksuse_frameworks!use_modular_headers!# Pods for Examplepod 'TIMPush', '7.9.5668'end
pod install # If you cannot install the latest version of TUIKit, run the following command to update the local CocoaPods repository list. pod repo update


Push Notification Service to your existing AppID.Bundle ID must not use the wildcard *, otherwise, the remote push service cannot be used.Bundle ID and other information, click Continue to proceed to the next step.

SSL Certificates, one for the Development environment and one for the Production environment.Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority).
*.certSigningRequest file.*.certSigningRequest file.
Development SSL Certificate for the development environment to your local machine.Production SSL Certificate for your production environment to your local system.Sandbox and Production, which can be used for both the development and production environments.SSL Certificate for both the development and production environments, and the system will import it into your keychain.Apple Development IOS Push Service) and the production environment (Apple Push Services).P12 file, be sure to set a password.



offlinePushCertificateID in AppDelegate to return the Certificate ID.import TIMPushfunc offlinePushCertificateID() -> Int32 {return kAPNSBusiId}
#pragma mark - TIMPush- (int)offlinePushCertificateID {return kAPNSBusiId;}
import TUICallKit_Swiftimport RTCRoomEnginelet pushInfo: TUIOfflinePushInfo = TUIOfflinePushInfo()pushInfo.title = ""pushInfo.desc = "You have a new call"pushInfo.iOSPushType = .apnspushInfo.ignoreIOSBadge = falsepushInfo.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-0000001149358835pushInfo.androidHuaWeiCategory = "IM"let params = TUICallParams()params.userData = "User Data"params.timeout = 30params.offlinePushInfo = pushInfoTUICallKit.createInstance().calls(userIdList: ["123456"], callMediaType: .audio, params: params) {} fail: { code, message in}
#import <TUICallKit_Swift/TUICallKit_Swift-Swift.h>#import <RTCRoomEngine/TUICallEngine.h>- (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 = @"You have a new call";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-0000001149358835pushInfo.AndroidHuaWeiCategory = @"IM";return pushInfo;}// Single person call example, similar for group call[[TUICallKit createInstance] calls:@[@"123456"]callMediaType:TUICallMediaTypeAudioparams:[self getCallParams] succ:^{} fail:^(int code, NSString * _Nullable errMsg) {}];
[[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";// OPPO must set ChannelID before it can receive push messages. This channelID needs to be consistent 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-0000001149358835pushInfo.AndroidHuaWeiCategory = @"IM";return pushInfo;}
let params = TUICallParams()let pushInfo: TUIOfflinePushInfo = TUIOfflinePushInfo()pushInfo.title = "TUICallKit"pushInfo.desc = "TUICallKit.have.new.invitation"pushInfo.iOSPushType = .apnspushInfo.ignoreIOSBadge = falsepushInfo.iOSSound = "phone_ringing.mp3"pushInfo.androidSound = "phone_ringing"// OPPO must set ChannelID before it can receive push messages. This channelID needs to be consistent 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-0000001149358835pushInfo.androidHuaWeiCategory = "IM"params.userData = "User Data"params.timeout = 30params.offlinePushInfo = pushInfoTUICallKit.createInstance().call(userId: "123456", callMediaType: .audio, params: params) {} fail: {code, message in}
Notification Service Extension to achieve continuous vibration. First, enable the mutable-content switch in the console.
Editor > Add Target > Notification Service Extension to create an Extension. The newly created Extension Target needs to configure the Apple certificate. For specific methods, you can refer here.// NotificationService.swiftimport UserNotificationsclass NotificationService: UNNotificationServiceExtension {var contentHandler: ((UNNotificationContent) -> Void)?var bestAttemptContent: UNMutableNotificationContent?override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {self.contentHandler = contentHandlerbestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)if let bestAttemptContent = bestAttemptContent {// Modify the notification content here...bestAttemptContent.title = "\\(bestAttemptContent.title) [modified]"contentHandler(bestAttemptContent)}}override func serviceExtensionTimeWillExpire() {// Called just before the extension will be terminated by the system.// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {contentHandler(bestAttemptContent)}}}
// NotificationService.swiftimport UserNotificationsclass NotificationService: UNNotificationServiceExtension {var contentHandler: ((UNNotificationContent) -> Void)?var bestAttemptContent: UNMutableNotificationContent?override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {self.contentHandler = contentHandlerbestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)if let bestAttemptContent = bestAttemptContent {contentHandler(bestAttemptContent)}// start ringing, VibratorFeature.start() needs to be implemented by yourselfVibratorFeature.start()}override func serviceExtensionTimeWillExpire() {if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {/// If there is no response for more than 30 seconds, the vibration and ringing function will be turned off.// stop ringing, RingingFeature.shared.stop() needs to be implemented by yourselfVibratorFeature.stop()contentHandler(bestAttemptContent)}}}
VibratorFeature.start() and stopping vibration VibratorFeature.stop() used in the above code need to be implemented by the customer.// Versions prior to iOS 13 monitor the foreground or background status through AppDelegate applicationWillEnterForeground// AppDelegate.swiftclass AppDelegate: UIResponder, UIApplicationDelegate {func applicationWillEnterForeground(_ application: UIApplication) {...sendStopRingingToExtension()}func sendStopRingingToExtension() {CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(),CFNotificationName("APNsStopRinging" as CFString), nil, nil, true)}}// Starting from iOS 13, monitor the foreground or background status through SceneDelegate sceneWillEnterForeground// SceneDelegate.swiftclass SceneDelegate: UIResponder, UIWindowSceneDelegate {func sceneWillEnterForeground(_ scene: UIScene) {...sendStopRingingToExtension()}func sendStopRingingToExtension() {CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(),CFNotificationName("APNsStopRinging" as CFString), nil, nil, true)}}
// NotificationService.swiftimport UserNotificationsclass NotificationService: UNNotificationServiceExtension {var contentHandler: ((UNNotificationContent) -> Void)?var bestAttemptContent: UNMutableNotificationContent?override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {self.contentHandler = contentHandlerbestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)if let bestAttemptContent = bestAttemptContent {contentHandler(bestAttemptContent)}// start ringing, VibratorFeature.start() needs to be implemented by yourselfVibratorFeature.start()registerObserver()}override func serviceExtensionTimeWillExpire() {if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {/// If there is no response for more than 30 seconds, the vibration and ringing function will be turned off.// stop ringing, RingingFeature.shared.stop() needs to be implemented by yourselfVibratorFeature.stop()contentHandler(bestAttemptContent)}}private func registerObserver() {CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),Unmanaged.passUnretained(self).toOpaque(), { center, pointer, name, _, userInfo inVibratorFeature.stop()}, "APNsStopRinging" as CFString, nil, .deliverImmediately)}}
- application:didRegisterForRemoteNotificationsWithDeviceToken: callback returns a token for the deployment environment. In this case, the businessID should be set to the production environment's Certificate ID.- application:didRegisterForRemoteNotificationsWithDeviceToken: callback returns a token for the development environment. In this case, the businessID should be set to the development environment's Certificate ID.Feedback