产品动态
产品近期公告
关于 TRTC Live 正式上线的公告
关于TRTC Conference 正式版上线的公告
Conference 商业化版本即将推出
关于多人音视频 Conference 开启内测公告
关于音视频通话 Call 正式版上线的公告
关于腾讯云音视频终端 SDK 播放升级及新增授权校验的公告
关于 TRTC 应用订阅套餐服务上线的相关说明
应用在后台时或离线时 | 锁屏时 |
![]() | ![]() |
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) && param != null) {String extString = (String) param.get(TUIConstants.TIMPush.NOTIFICATION_EXT_KEY);try {JSONObject roomObject = new JSONObject(extString);String notificationType = roomObject.getString("NotificationType");if ("conference_invitation".equals(notificationType)) {login(new TUICallback() {@Overridepublic void onSuccess() {}@Overridepublic void onError(int errorCode, String errorMessage) {}});}} catch (Exception e) {}}}});private void login(TUICallback callback) {int sdkAppId = 您的sdkappid;String userId = "您的userId";String userSig = "您的userSig";TUILogin.login(this.getApplicationContext(), sdkAppId, userId, userSig, new TUICallback() {@Overridepublic void onSuccess() {if (callback != null) {callback.onSuccess();}}@Overridepublic void onError(int errorCode, String errorMessage) {if (callback != null) {callback.onError(errorCode, errorMessage);}}});}
pod 'TIMPush', '8.1.6108'
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 = YourLoginViewController() // 您自己的登录页面loginVC.extString = 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 }return extString}
#import "SceneDelegate.h"#import <UserNotifications/UserNotifications.h>#import "TUIRoomKit/TUIRoomKit-Swift.h"#import "TIMDefine.h"@interface SceneDelegate ()@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 *extString = pushNotification[@"ext"];//将extString传给您自己的登录页面YourLoginViewController}@end
import TUICoreimport TUIRoomKit//YourLoginViewController 是您自己的登录页面class YourLoginViewController: UIViewController {var extString: 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是正常登录后应该显示的您自己的界面guard let extString = self.extString else { return }guard let notificationType = dict["NotificationType"] as? String else { return }// 通过notificationType判断是否为会中呼叫提醒,由此判断是否再拉起被呼叫页面if notificationType == "conference_invitation" {InvitationObserverService.shared.show(extString: extString) // 调用此方法以拉起被呼叫界面}self.extString = nil} fail: { (code, errorDes) inprint("code:\\(code), errorDes:\\(String(describing: errorDes))")}}}
#import "YourLoginViewController.h"#import "TUIRoomKit/TUIRoomKit-Swift.h"#import "TUILogin.h"@interface YourLoginViewController ()@property (nonatomic, strong) NSString *extString;@end@implementation YourLoginViewController- (void)viewDidLoad {[super viewDidLoad];[TUILogin login:yourSDKAPPID userID:@"youruserID" userSig:@"yourUserSig" succ:^{//先显示您自己的界面//如果extString有值,说明是从离线推送进来的,可以调用showInitationView拉起被呼叫界面} fail:^(int code, NSString * _Nullable msg) {}];// Do any additional setup after loading the view.}- (void)showInitationView: (NSString *)extString {[[InvitationObserverService shared] show:extString];}
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 {InvitationObserverService.shared.show(extString: extString) // 调用此方法以拉起被呼叫界面}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 ) {[[InvitationObserverService shared] show:extString];}return true;}@end
厂商通道 | 是否需要上架 | 账号说明 |
小米 | 是 | 需要注册企业开发者账号 |
VIVO | 是 | 需要注册企业开发者账号 |
OPPO | 否 | 需要注册企业开发者账号 |
荣耀 | 否 | 需要注册企业开发者账号 |
华为 | 否 | 个人开发者账号即可 |
魅族 | 否 | 个人开发者账号即可 |
// 文件位置:Android/tuiroomkit/src/main/java/com/tencent/cloud/tuikit/roomkit/view/component/component└──InvitationReceivedView.java
// 文件位置:iOS/TUIRoomKit/Source/View/ConferenceOptions/ConferenceInvitationConferenceInvitation└── ConferenceInvitationViewController.swift // 被呼叫页面视图
文档反馈