Packages/manifest.json and adding the related dependencies:{"dependencies": {..."com.tencent.timpush.unity": "https://github.com/TencentCloud/TIMSDK.git#push_unity"}}

UnityIMPush.mm under Assets/Plugins/iOS (create the directory manually if it does not exist), and implement the businessID protocol method to return the certificate ID. You can refer to the following implementation:#import "TPush/TPush.h"#import "UnityAppController.h"@interface UnityAppController (ThirdPartyExtension) <TIMPushDelegate>- (int)businessID;- (NSString *)applicationGroupID;@end@implementation UnityAppController (ThirdPartyExtension)#pragma mark - TIMPush- (int)businessID {// Certificate ID from the Console in the previous step, for example 1234567int kBusinessID = 1234567;return kBusinessID;}- (NSString *)applicationGroupID {//AppGroup IDreturn "AppGroup ID";}- (BOOL)onRemoteNotificationReceived:(NSString *)notice {// custom navigatereturn NO;}@end
timpush-configs.json under Assets/Plugins/Android. If the directory does not exist, create it manually.

dependencies block at the end of the file, and include all or some of the manufacturer push packages as needed. Native push for a manufacturer is enabled only after you add the corresponding package.dependencies {// Replace VERSION with the version from Release Notes.// The main push package is requiredimplementation 'com.tencent.timpush:tpush:VERSION'// Other dependenciesimplementation 'androidx.appcompat:appcompat:1.3.0'implementation 'com.google.code.gson:gson:2.10.1'// Add manufacturer packages as neededimplementation 'com.tencent.timpush:fcm:VERSION'}


buildscript, place it at the top of the file):buildscript {dependencies {...classpath 'com.google.gms:google-services:4.3.15'}}
pluginManagement {repositories {gradlePluginPortal()mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }}}dependencyResolutionManagement {...repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }}}
buildscript {repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }}dependencies {...classpath 'com.google.gms:google-services:4.2.0'}}
allprojects {...repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }}}
buildscript and allprojects, add:buildscript {repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }}dependencies {...classpath 'com.google.gms:google-services:4.2.0'}}allprojects {repositories {mavenCentral()maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }}}
apply plugin: 'com.google.gms.google-services'

PushListener listener = new PushListener(onRecvPushMessage: (message) => {Debug.Log($"Received push message: title:{message.title}, content:{message.desc}, passthrough:{message.ext}, message ID:{message.messageID}");}, onRevokePushMessage: (messageID) => {Debug.Log($"Revoked push message ID: {messageID}");}, onNotificationClicked: (ext) => {Debug.Log($"Notification clicked: {ext}");});PushManager.AddPushListener(listener);
PushManager.RegisterPush succeeds, the app can receive offline push notifications.appKey to null; otherwise the Chat account will be logged out.PushManager.RegisterPush(sdkAppId: YourSdkAppId, appKey: "AppKey", new PushCallback(onSuccess: (data) => {Debug.Log($"Push registration succeeded: {data}");}, onError: (errCode, errMsg, data) => {Debug.Log($"Push registration failed: error code:{errCode}, error message:{errMsg}");}));
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan