产品动态
公告
拷贝目录 | 引入插件 |
![]() | ![]() |

Additional Plist Data 并将下面文本修改后复制进入文本框中,其中 YourBusinessID 是必填项,而 YourGroupID 是当您需要统计推送的抵达和点击数据时需要修改的值<key>businessID</key><string>YourBusinessID</string><key>TIMPushAppGroupID</key><string>YourGroupID</string>

<proj_dir>/Config/DefaultEngine.ini” ,在脚本的 IOSRuntimeSettings 中添加:// Some code[/Script/IOSRuntimeSettings.IOSRuntimeSettings]bEnableRemoteNotificationsSupport=True


timpush-configs.json 文件添加到 TIMPush 的 Source/ThirdParty/TIMPushLibrary/Android/TIMPush/Assets 目录下。下载配置文件 | 拷贝路径 |
![]() | ![]() |

<buildGradleAdditions><insert>dependencies {// 推送主包必须要集成implementation 'com.tencent.timpush:tpush:VERSION'// 按照需要集成对应厂商implementation 'com.tencent.timpush:huawei:VERSION'implementation 'com.tencent.timpush:xiaomi:VERSION'implementation 'com.tencent.timpush:oppo:VERSION'implementation 'com.tencent.timpush:vivo:VERSION'implementation 'com.tencent.timpush:honor:VERSION'implementation 'com.tencent.timpush:meizu:VERSION'implementation 'com.tencent.timpush:fcm:VERSION'}</insert></buildGradleAdditions>
<buildGradleAdditions><insert>android {defaultConfig {manifestPlaceholders = ["VIVO_APPKEY" : "xxxxxx", // VIVO AppKey"VIVO_APPID" : "xxxxxx", // VIVO AppId"HONOR_APPID" : "xxxxxx" // Honor AppId]}}</insert></buildGradleAdditions>
Source/ThirdParty/TIMPushLibrary/Android/TIMPush/ 目录下。



<baseBuildGradleAdditions><insert>allprojects {repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }maven { url "https://mirrors.tencent.com/repository/maven/liteavsdk/" }maven { url 'https://developer.huawei.com/repo/' }maven { url 'https://mirrors.tencent.com/repository/maven/SensitiveScan' }maven { url 'https://developer.hihonor.com/repo' }}}</insert></baseBuildGradleAdditions><buildscriptGradleAdditions><insert>repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }maven { url "https://mirrors.tencent.com/repository/maven/liteavsdk/" }maven { url 'https://developer.huawei.com/repo/' }maven { url 'https://mirrors.tencent.com/repository/maven/SensitiveScan' }maven { url 'https://developer.hihonor.com/repo' }}dependencies {classpath 'com.google.gms:google-services:4.4.3' // FCM Pluginclasspath 'com.huawei.agconnect:agcp:1.9.1.300' // Huawei Pluginclasspath 'com.hihonor.mcs:asplugin:2.0.1.300' // Honor Plugin}</insert></buildscriptGradleAdditions><buildGradleAdditions><insert>apply plugin: 'com.google.gms.google-services' // FCM Pluginapply plugin: 'com.huawei.agconnect' // Huawei Pluginapply plugin: 'com.hihonor.mcs.asplugin' // Honor Plugin</insert></buildGradleAdditions>

class DemoPushListener: public PushListener {public:using OnRecvPushMessageCallback = std::function<void(const PushMessage &)>;using OnRevokePushMessageCallback = std::function<void(const FString &)>;using OnNotificationClickedCallback = std::function<void(const FString &)>;void SetCallback(OnRecvPushMessageCallback recv_cb, OnRevokePushMessageCallback revoke_cb, OnNotificationClickedCallback clicked_cb) {on_recv_message_callback_ = std::move(recv_cb);on_revoke_message_callback_ = std::move(revoke_cb);on_notification_clicked_callback_ = std::move(clicked_cb);}void OnRecvPushMessage(const PushMessage& message) override {if (on_recv_message_callback_) {on_recv_message_callback_(message);}}void OnRevokePushMessage(const FString& messageID) override {if (on_revoke_message_callback_) {on_revoke_message_callback_(messageID);}}void OnNotificationClicked(const FString& ext) override {if (on_notification_clicked_callback_) {on_notification_clicked_callback_(ext);}}private:OnRecvPushMessageCallback on_recv_message_callback_;OnRevokePushMessageCallback on_revoke_message_callback_;OnNotificationClickedCallback on_notification_clicked_callback_;};auto listener = new DemoPushListener();listener.SetCallback([](const PushMessage& message) {UE_LOG(LogTemp, Warning, TEXT("Push Called in OnRecvPushMessage. Message title: %s, desc: %s, ext: %s, id: %s"), *message.GetTitle(), *message.GetDesc(), *message.GetExt(), *message.GetMessageID());},[](const FString& messageID) {UE_LOG(LogTemp, Warning, TEXT("Push Called in OnRevokePushMessage. Message id: %s"), *messageID);},[](const FString& ext) {UE_LOG(LogTemp, Warning, TEXT("Push Called in OnNotificationClicked. Message ext: %s"), *ext);});PushManager::GetInstance()->AddPushListener(&DEMO_PUSH_LISTENER);
template <class T>class DemoPushValueCallback : public PushValueCallback<T> {public:using SuccessCallback = std::function<void(const T &)>;using ErrorCallback = std::function<void(int, const FString &)>;DemoPushValueCallback<T>() = default;~DemoPushValueCallback() override = default;void SetCallback(SuccessCallback success_cb, ErrorCallback error_cb) {success_callback_ = std::move(success_cb);error_callback_ = std::move(error_cb);}void OnSuccess(const T &value) override {if (success_callback_) {success_callback_(value);}}void OnError(int error_code, const FString &error_message) override {if (error_callback_) {error_callback_(error_code, error_message);}}private:SuccessCallback success_callback_;ErrorCallback error_callback_;};auto callback = new DemoPushValueCallback<FString>();callback->SetCallback([=](const FString &value) {UE_LOG(LogTemp, Warning, TEXT("Push succeed, device token is %s"), *value);delete callback;},[=](int error_code, const FString &error_message) {UE_LOG(LogTemp, Warning, TEXT("Push failed erro code: %d, desc: %s"), error_code, *error_message);delete callback;});PushManager::GetInstance()->RegisterPush(您的 sdkAppId, "您的 appKey", callback);


回调地址配置 | 回执 ID 配置 IM 控制台 |
![]() 回执地址: https://api.im.qcloud.com/v3/offline_push_report/vivo | ![]() |
打开回执开关 | 配置回执地址 |
![]() | ![]() |
Editor - Add Target 中开启 Notification Service Extension Target。Plugins-TIMPush-Source-ThirdParty-TIMPushLibrary-iOS 路径中的两个 framework 压缩包解压缩,并在Xcode项目中将内部的 .framework 文件夹添加到您的 pushservice target 之中。-didReceiveNotificationRequest:withContentHandler: 方法中调用推送抵达率统计函数:@implementation NotificationService- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {//appGroup 标识当前主 APP 和 Extension 之间共享的 APP Group,需要在主 APP 的 Capability 中配置 App Groups 能力。//格式为group + [主bundleID]+ key//如group.com.tencent.im.pushkeyNSString * appGroupID = kTIMPushAppGroupKey;__weak typeof(self) weakSelf = self;[TIMPushManager handleNotificationServiceRequest:request appGroupID:appGroupID callback:^(UNNotificationContent *content) {weakSelf.bestAttemptContent = [content mutableCopy];// Modify the notification content here...// self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];weakSelf.contentHandler(weakSelf.bestAttemptContent);}];}@end

文档反馈