flutter pub addtencent_cloud_chat_push
Push Notification
Service
to your existing AppID.Bundle ID
cannot use the wildcard *
; otherwise, the remote push service cannot be used.Bundle ID
and other information, click Continue to proceed to the next step.SSL Certificates
, one for the development environment (Development) and the other for the production environment (Production) remote push certificates, as shown below:Keychain Access - Certificate Assistant - Request a Certificate From a Certificate Authority
).*.certSigningRequest
file.*.certSigningRequest
file.Development SSL Certificate
for your development environment to your local system.Production SSL Certificate
for your production environment to your local system.SSL Certificate
for both the development and production environments, and the system will import it into your keychain.Apple Development IOS Push Service
) and Production (Apple Push Services
) environment's P12
files.P12
file, be sure to set a password.Vendor Push Platform | Configuring in the IM console |
| |
TencentCloudChatPush().setApnsCertificateID
method to pass in this Certificate ID.TencentCloudChatPush().setApnsCertificateID(apnsCertificateID: Certificate ID);
android/app/src/main/assets
directory. If the directory is non-existent, manually create it.1. Select to download the configuration file timpush-configs.json | 1. Add it to your project |
| |
ios/Runner/AppDelegate.swift
file, paste the circled code below into it, as shown in the figure. The code is attached after the image.import UIKitimport Flutter// Add these two import linesimport TIMPushimport tencent_cloud_chat_push// Add `, TIMPushDelegate` to the following line@UIApplicationMain@objc class AppDelegate: FlutterAppDelegate, TIMPushDelegate {override func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {GeneratedPluginRegistrant.register(with: self)return super.application(application, didFinishLaunchingWithOptions: launchOptions)}// Add this functionfunc offlinePushCertificateID() -> Int32 {return TencentCloudChatPushFlutterModal.shared.offlinePushCertificateID();}// Add this functionfunc applicationGroupID() -> String {return TencentCloudChatPushFlutterModal.shared.applicationGroupID()}// Add this functionfunc onRemoteNotificationReceived(_ notice: String?) -> Bool {TencentCloudChatPushPlugin.shared.tryNotifyDartOnNotificationClickEvent(notice)return true}}
MainActivity
under your project's android path, create a new Application file category, which could be named MyApplication
.package xxxx.xxxx.xx import com.tencent.chat.flutter.push.tencent_cloud_chat_push.application.TencentCloudChatPushApplication; public class MyApplication extends TencentCloudChatPushApplication { @Override public void onCreate() { super.onCreate(); } }
extend TencentCloudChatPushApplication
and ensure that onCreate()
method is called in super.onCreate();
.android/app/src/main/AndroidManifest.xml
file, then add a specific android:name
parameter to the <application>
Tag, which is linked to your newly created Definition Application
class as shown in the figure:dependencies {// Google Firebase Cloud Messaging (Google FCM)implementation 'com.tencent.timpush:fcm:${version number of push plugin}' }
buildscript {dependencies {...classpath 'com.huawei.agconnect:agcp:1.6.0.300' classpath 'com.hihonor.mcs:asplugin:2.0.1.300' classpath 'com.google.gms:google-services:4.4.0'}}
pluginManagementbuildscript {repositories {gradlePluginPortal() mavenCentral() maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } // The Maven repository address of HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.hihonor.com/repo'}}}allprojects {...repositories {mavenCentral() maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } // Configuration of the Maven repository address for HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.hihonor.com/repo'}}}}
buildscript {repositories {mavenCentral() maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } // Configuration of the Maven repository address for HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.hihonor.com/repo'}}dependencies {...classpath 'com.google.gms:google-services:4.2.0'classpath 'com.huawei.agconnect:agcp:1.4.1.300'classpath 'com.hihonor.mcs:asplugin:2.0.1.300'}}
allprojects {...repositories {mavenCentral() maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } // Configuration of the Maven repository address for HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.hihonor.com/repo'}}}
buildscript {repositories {mavenCentral() maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } // Configuration of the Maven repository address for HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.hihonor.com/repo'}}dependencies {...classpath 'com.google.gms:google-services:4.2.0'classpath 'com.huawei.agconnect:agcp:1.4.1.300'classpath 'com.hihonor.mcs:asplugin:2.0.1.300'}}allprojects {repositories {mavenCentral() maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" } // Configuration of the Maven repository address for HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.hihonor.com/repo'}}}
apply plugin: 'com.google.gms.google-services'apply plugin: 'com.huawei.agconnect'apply plugin: 'com.hihonor.mcs.asplugin'
{required String ext, String? userID, String? groupID}
.void _onNotificationClicked({required String ext, String? userID, String? groupID}) { print("_onNotificationClicked: $ext, userID: $userID, groupID: $groupID"); if (userID != null || groupID != null) { // Navigate to the corresponding Message page based on `userID` or `groupID`. } else { // Based on the `ext` field, write your own parsing method to navigate to the corresponding page. } }
TencentCloudChatPush().registerPush
method, it necessitates the transmission of BackDefinition's click callback function.apnsCertificateID
, the iOS push certificate ID, and androidPushOEMConfig
, the Android push vendor configuration. These two configurations were previously specified in the initial steps; should there be no need for amendment, there is no requirement to input them again.TencentCloudChatPush().registerPush(onNotificationClicked: _onNotificationClicked);
TencentCloudChatPush().registerOnNotificationClickedEvent
method, manually mount the message click callback, to access the message parameters in a timely manner.TencentCloudChatPush().registerPush
and position it as early as feasible in the code.TencentCloudChatPush().registerOnNotificationClickedEvent(onNotificationClicked: _onNotificationClicked);
TUIOfflinePushInfo offlinePushInfo = TUIOfflinePushInfo();offlinePushInfo.title = "Flutter TUICallKit";offlinePushInfo.desc = "This is an incoming call from Flutter TUICallkit";offlinePushInfo.ignoreIOSBadge = false;offlinePushInfo.iOSSound = "phone_ringing.mp3";offlinePushInfo.androidSound = "phone_ringing";offlinePushInfo.androidOPPOChannelID = "Flutter TUICallKit";offlinePushInfo.androidVIVOClassification = 1;offlinePushInfo.androidFCMChannelID = "fcm_push_channel";offlinePushInfo.androidHuaWeiCategory = "Flutter TUICallKit";offlinePushInfo.iOSPushType = TUICallIOSOfflinePushType.VoIP;TUICallParams params = TUICallParams(offlinePushInfo: offlinePushInfo);TUICallKit.instance.call(callUserId, TUICallMediaType.audio, params);
Was this page helpful?