Android | iOS |
| |
flutter pub addtencent_cloud_chat_push
google-services.json
文件 ,来实现离线推送功能。厂商推送平台 | Chat 控制台配置 |
| |
timpush-configs.json
文件添加到应用模块的 assets
目录下,将 google-services.json
添加到工程app目录下。选择下载配置文件 timpush-configs.json | 下载文件 google-services.json | 添加到工程 |
| | |
build.gradle
文件中添加如下依赖:implementation "com.tencent.timpush:fcm: xxxxxx"
build.gradle
中添加的依赖的版本需要与tencent_cloud_chat_push
版本对应。MainActivity
同级目录中,新建一个新的 Application 文件类, 例如可命名为 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(); } }
extends TencentCloudChatPushApplication
并保证 onCreate()
函数中,调用了 super.onCreate();
即可。android/app/src/main/AndroidManifest.xml
文件,为 <application>
标签,新增指定一个 android:name
参数即可,指向刚制作的自定义 Application
类。如图所示:build.gradle
文件的 buildscript -> dependencies 下添加以下配置:buildscript {dependencies {classpath 'com.google.gms:google-services:4.3.15'}}
build.gradle
文件中添加下方配置:apply plugin: 'com.google.gms.google-services'
TencentCloudChatPush().registerPush
方法, 需传入上一步定义的点击回调函数。apnsCertificateID
iOS 推送证书 ID 及 androidPushOEMConfig
Android 推送厂商配置。此二项配置已在前序步骤指定,若无修改必要,可不再传入。TencentCloudChatPush().registerPush(onNotificationClicked: _onNotificationClicked);
onAppWakeUpEvent
中实现登录以及拉起APP等操作。TencentCloudChatPush().registerOnAppWakeUpEvent(onAppWakeUpEvent: () {// TODO: 登录操作});
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.androidFCMChannelID = "fcm_push_channel";offlinePushInfo.iOSPushType = TUICallIOSOfflinePushType.VoIP;TUICallParams params = TUICallParams(offlinePushInfo: offlinePushInfo);TUICallKit.instance.call(callUserId, TUICallMediaType.audio, params);
本页内容是否解决了您的问题?