When the application is in the backend or offline | When the screen is locked |
![]() | ![]() |
TUICore.registerEvent(TUIConstants.TIMPush.EVENT_NOTIFY, TUIConstants.TIMPush.EVENT_NOTIFY_NOTIFICATION, new ITUINotification() {@Overridepublic void onNotifyEvent(String key, String subKey, Map<String, Object> param) {if (TUIConstants.TIMPush.EVENT_NOTIFY.equals(key) && TUIConstants.TIMPush.EVENT_NOTIFY_NOTIFICATION.equals(subKey)) {if (param != null) {String extString = (String) param.get(TUIConstants.TIMPush.NOTIFICATION_EXT_KEY);try {// You can click on the notification to navigate to the appropriate interface according to your business. The following is an example of navigating to a room.JSONObject roomObject = new JSONObject(extString);String roomId = roomObject.getString("RoomId");if (!TextUtils.isEmpty(roomId)) {loginAndEnterRoom(roomId);}} catch (Exception e) {}}}}});private void loginAndEnterRoom(String roomId) {int sdkAppId = "your appId";String userId = "your UserId"String userSig = GenerateTestUserSig.genTestUserSig(userId);// Log inTUILogin.login(this.getApplicationContext(), sdkAppId, userId, userSig, new TUICallback() {@Overridepublic void onSuccess() {// Enter a room after successful log-inConferenceDefine.JoinConferenceParams params = new ConferenceDefine.JoinConferenceParams(roomId);Intent intent = new Intent(getApplicationContext(), ConferenceMainActivity.class);intent.putExtra(KEY_JOIN_CONFERENCE_PARAMS, params);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);getApplicationContext().startActivity(intent);}@Overridepublic void onError(int errorCode, String errorMessage) {}});}
pod 'TIMPush', '8.1.6108'
offlinePushCertificateID protocol method in AppDelegate and return the certificate ID.import TIMPushextension AppDelegate: TIMPushDelegate {func offlinePushCertificateID() -> Int32 {return kAPNSBusiId}}
#import "TIMPush/TIMPushManager.h"@interface AppDelegate () <TIMPushDelegate>- (int)offlinePushCertificateID {return kAPNSBusiId;}
import UIKitclass SceneDelegate: UIResponder, UIWindowSceneDelegate {var window: UIWindow?func scene(_ scene: UIScene,willConnectTo session: UISceneSession,options connectionOptions: UIScene.ConnectionOptions) {guard let windowScene = (scene as? UIWindowScene) else { return }window = UIWindow(windowScene: windowScene)let loginVC = TRTCLoginViewController() //Your own login pageloginVC.roomId = processOfflinePush(connectionOptions: connectionOptions)let nav = UINavigationController(rootViewController: loginVC)window?.rootViewController = navwindow?.makeKeyAndVisible()}private func processOfflinePush(connectionOptions: UIScene.ConnectionOptions) -> String? {guard let pushNotification = connectionOptions.notificationResponse?.notification.request.content.userInfo else { return nil }guard let extString = pushNotification["ext"] as? String else { return nil }guard let dict = extString.convertToDic() else { return nil }return dict["RoomId"] as? String}
#import "SceneDelegate.h"#import <UserNotifications/UserNotifications.h>#import "TUIRoomKit/TUIRoomKit-Swift.h"#import "TIMDefine.h"@interface SceneDelegate ()@property (nonatomic, strong) NSString *roomId;@end@implementation SceneDelegate- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {[self processOfflinePush:connectionOptions];}- (void)processOfflinePush: (UISceneConnectionOptions *)connectionOptions {NSDictionary *pushNotification = connectionOptions.notificationResponse.notification.request.content.userInfo;NSString *notice = pushNotification[@"ext"];NSDictionary *dic = [self dictionaryFromString:notice];NSString *roomId = dic[@"RoomId"];// Transmit the roomId to your own login page YourLoginViewController}@end
import TUICoreimport TUIRoomKit//YourLoginViewController is your own login pageclass YourLoginViewController: UIViewController {var roomId: String?override func viewDidLoad() {super.viewDidLoad()TUILogin.login(Int32(SDKAppID), userID: "yourUserName", userSig: "yourUserSig") { [weak self] inguard let self = self else { return }self.navigationController?.pushViewController(YourSelfViewController(), animated: false)//YourSelfViewController is the interface that should be displayed after normal login.guard let roomId = self.roomId else { return }//Determine whether to enter the foreground through offline notification by roomId, and then determine whether to redirect to the Conference main pageself.showConferenceMainViewController(roomId: roomId)self.roomId = nil} fail: { (code, errorDes) inprint("code:\\(code), errorDes:\\(String(describing: errorDes))")}}func showConferenceMainViewController(roomId: String) {let conferenceViewController = ConferenceMainViewController()let params = JoinConferenceParams(roomId: roomId)conferenceViewController.setJoinConferenceParams(params: params)navigationController?.pushViewController(conferenceViewController, animated: true)}}
#import "YourLoginViewController.h"#import "TUIRoomKit/TUIRoomKit-Swift.h"#import "TUILogin.h"@interface YourLoginViewController ()@property (nonatomic, strong) NSString *roomId;@end@implementation YourLoginViewController- (void)viewDidLoad {[super viewDidLoad];[TUILogin login:yourSDKAPPID userID:@"youruserID" userSig:@"yourUserSig" succ:^{//First display your own interface//If roomId has a value, it means it comes from offline push. You can call showConferenceMainViewController and then redirect to the Conference main page.} fail:^(int code, NSString * _Nullable msg) {}];// Do any additional setup after loading the view.}- (void)showConferenceMainViewController: (NSString *)roomId {ConferenceMainViewController * vc = [[ConferenceMainViewController alloc]init];JoinConferenceParams * params = [[JoinConferenceParams alloc]initWithRoomId:roomId isOpenMicrophone:true isOpenCamera:false isOpenSpeaker:true];[vc setJoinConferenceParamsWithParams:params];[self.navigationController pushViewController:vc animated:true];}
onRemoteNotificationReceived method in the AppDelegate file.import TUIRoomKitimport TIMPush@mainclass AppDelegate: UIResponder, UIApplicationDelegate, TIMPushDelegate {var roomId: String?func onRemoteNotificationReceived(_ notice: String?) -> Bool {guard let notice = notice else { return false }guard let dict = convertToDic(string: notice) else { return false }guard let roomId = dict["RoomId"] as? String else { return false }if V2TIMManager.sharedInstance().getLoginStatus() == .STATUS_LOGINED {//If woken up in the background and login has been completed, directly enter the meeting.showConferenceMainViewController(roomId: roomId)}return true}}
#import "AppDelegate.h"#import "TIMPush/TIMPushManager.h"#import "TUIRoomKit/TUIRoomKit-Swift.h"#import "TIMDefine.h"@interface AppDelegate ()<TIMPushDelegate>@property (nonatomic, strong) NSString *roomId;@end@implementation AppDelegate- (BOOL)onRemoteNotificationReceived:(NSString *)notice {NSDictionary * dic = [self dictionaryFromString:notice];NSString * roomId = dic[@"RoomId"];if (!roomId) {return false;}if ([V2TIMManager sharedInstance].getLoginStatus == V2TIM_STATUS_LOGINED ) {//If woken up in the background and login has been completed, directly enter the meeting.[self showConferenceMainViewController:roomId];}return true;}@end
Manufacturer Channel | Whether to List | Account Description |
Xiaomi | Yes | Need to register an enterprise developer account. |
VIVO | Yes | Need to register an enterprise developer account. |
OPPO | No | Need to register an enterprise developer account. |
Honor | No | Need to register an enterprise developer account. |
Huawei | No | An individual developer account is all you need. |
Meizu | No | An individual developer account is all you need. |
REMINDER_TIME member variable in Android/tuiroomkit/src/main/java/com/tencent/cloud/tuikit/roomkit/view/page/widget/ScheduleConference/view/ScheduleConferenceView.java.public abstract void scheduleConference(ConferenceInfo conferenceInfo, TUIRoomDefine.ActionCallback callback);
TUIConferenceListManager manager = (TUIConferenceListManager) TUIRoomEngine.sharedInstance().getExtension(CONFERENCE_LIST_MANAGER);TUIConferenceListManager.ConferenceInfo conferenceInfo = new TUIConferenceListManager.ConferenceInfo();conferenceInfo.basicRoomInfo.roomId = "Your roomId";conferenceInfo.reminderSecondsBeforeStart = 600; // Replace 600 with your pre-meeting reminder timemanager.scheduleConference(conferenceInfo, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successful callback for scheduling a meeting}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Callback for scheduled meeting failure}});
- (void)scheduleConference:(TUIConferenceInfo *)conferenceInfo onSuccess:(TUISuccessBlock)onSuccess onError:(TUIErrorBlock)onError NS_SWIFT_NAME(scheduleConference(_:onSuccess:onError:));
import RTCRoomEnginefunc scheduleConference() {let manager = TUIRoomEngine.sharedInstance().getExtension(extensionType: .conferenceListManager) as? TUIConferenceListManagerlet conferenceInfo = TUIConferenceInfo()conferenceInfo.basicRoomInfo.roomId = "111111" // Replace "111111" with your custom room numberconferenceInfo.reminderSecondsBeforeStart = 600 // Replace 600 with your custom pre-meeting reminder timemanager?.scheduleConference(conferenceInfo, onSuccess: {print("ScheduleConference success")}, onError: { code, message inprint("ScheduleConference error, code:\\(code), message:\\(message)")})}
#import "RTCRoomEngine/TUIRoomEngine.h"#import "RTCRoomEngine/TUIConferenceListManager.h"- (void)scheduleConference {TUIConferenceListManager * manager = [[TUIRoomEngine sharedInstance] getExtension: TUIExtensionTypeConferenceListManager];TUIConferenceInfo * conferenceInfo = [[TUIConferenceInfo alloc] init];conferenceInfo.basicRoomInfo.roomId = @"111111"; // Replace @"111111" with your custom room numberconferenceInfo.reminderSecondsBeforeStart = 600; // Replace 600 with your custom pre-meeting reminder time[manager scheduleConference:conferenceInfo onSuccess:^{NSLog(@"ScheduleConference success");} onError:^(TUIError code, NSString * _Nonnull message) {NSLog(@"ScheduleConference failed, code:%ld, message:%@", (long)code, message);}];}
Feedback