| iPhone 13 | Samsung Galaxy A23 Overseas Version (Google FCM Push) |
manifestPlaceholders.json
and mcs-services.json
.nativeResources
directory. If this folder is not yet created in the project root directory, please create a new folder named nativeResources
.nativeResources
directory exists in the project opened with HBuilderX and is at the same level as the uni_modules
directory.nativeResources/android/assets
.timpush-configs.json
(download from Push Service > Access Settings > One-click Quick Configuration) to the nativeResources/android/assets/
directory. As shown in the figure:com.google.gms.google-services
to uni_modules/TencentCloud-Push/utssdk/app-android/config.json
in project.plugins
, as shown below:"project": {"plugins": [..."com.google.gms.google-services"],"dependencies": ["com.huawei.agconnect:agcp:1.9.1.301","com.google.gms:google-services:4.3.15","com.hihonor.mcs:asplugin:2.0.1.300"]}
google-services.json
file to the nativeResources/android/
directory (Note! Do not configure it to the nativeResources/android/assets
directory). As shown in the figure:agconnect-services.json
(for details on obtaining this file, see Manufacturer configuration > Huawei > Step 4: Obtain Application Information) to the nativeResources/android/assets/
directory. As shown in the figure:uni_modules/TencentCloud-Push/utssdk/app-android/config.json
in dependencies
, add "com.tencent.timpush:honor:8.3.6498"
.{..."dependencies": [..."com.tencent.timpush:honor:8.3.6498"]}
mcs-services.json
file to the nativeResources/android
directory (for details on obtaining this file, see Manufacturer configuration > Honor > Step 3.2: Enter Application Details, Bind Application Package Name, Download mcs-services.json File).appID
to nativeResources/android/manifestPlaceholders.json
in "HONOR_APPID"
.{"HONOR_APPID": ""}
uni_modules/TencentCloud-Push/utssdk/app-android/config.json
in dependencies
, add "com.tencent.timpush:vivo:8.3.6498"
.{..."dependencies": [..."com.tencent.timpush:vivo:8.3.6498"]}
appID
and appKey
to nativeResources/android/manifestPlaceholders.json
in VIVO_APPKEY
and VIVO_APPID
.{"VIVO_APPKEY": "","VIVO_APPID": "",}
nativeResources/ios/Resources
.timpush-configs.json
file in nativeResources/ios/Resources
.timpush-configs.json
file. As shown below:{"businessID":"xxx"}
SDKAppID
and appKey
with the application information obtained from IM Console - Push Service - Access Settings page. As shown in the figure:import { TUILogin } from '@tencentcloud/tui-core';import { TUIConversationService } from '@tencentcloud/chat-uikit-engine';import * as Push from '@/uni_modules/TencentCloud-Push';const SDKAppID = 0; // Your SDKAppIDconst appKey = ''; // Client Keyconst userID = ''; // Your userIDconst userSig = ''; // Your userID's keylet vueVersion = 2;// #ifdef VUE3vueVersion = 3;// #endifTUILogin.login({SDKAppID,userID,userSig,useUploadPlugin: true,framework: `vue${vueVersion}`,}).then(() => {if (Push) {Push.setRegistrationID(userID, () => {console.log('setRegistrationID ok', userID);Push.registerPush(SDKAppID, appKey, (data) => {console.log('registerPush ok', data);Push.getRegistrationID((registrationID) => {console.log('getRegistrationID ok', registrationID);});}, (errCode, errMsg) => {console.error('registerPush failed', errCode, errMsg);});});// Listen for notification bar click events to get push extension informationPush.addPushListener(Push.EVENT.NOTIFICATION_CLICKED, (res) => {console.log('notification clicked', res);// Parse extended information and navigate to the corresponding session (code for reference, needs improvement before release)try {const data = JSON.parse(res.data);const conv_type = data?.entity?.chatType === 1 ? 'C2C' : 'GROUP';// Constructed conversationID based on push informationconst conversationID = `${conv_type}${data.entity.sender}`;// Switch sessionTUIConversationService.switchConversation(conversationID);const chatPath = '/TUIKit/components/TUIChat/index';uni.navigateTo({ url: chatPath });} catch (error) {console.log('error', error);}});// Listen for online pushPush.addPushListener(Push.EVENT.MESSAGE_RECEIVED, (res) => {// res is the message contentconsole.log('message received', res);});// Listen for online push recallPush.addPushListener(Push.EVENT.MESSAGE_REVOKED, (res) => {// res is the ID of the recalled messageconsole.log('message revoked', res);});}});
Was this page helpful?