Firebase Cloud Messaging (FCM)
提供的数据消息能力 以及TUICallKit
组件,能够实现具有自定义布局的来电显示界面。TIMPush
插件,使用 FCM 的数据消息能力,实现音视频通话的横幅来电显示效果。应用在前台时的显示效果 | 应用在后台时或者离线时的显示效果 |
| |
google-services.json
文件 ,来实现离线推送功能。厂商推送平台 | IM 控制台配置 |
| |
timpush-configs.json
文件添加到应用模块的 assets
目录下,将 google-services.json
添加到工程app目录下。下载文件 timpush-configs.json | 下载文件 google-services.json | 添加到工程 |
| | |
build.gradle
文件中添加如下依赖:implementation "com.tencent.timpush:timpush:7.9.5668"implementation "com.tencent.timpush:fcm:7.9.5668"
tuicallkit-kt/build.gradle
文件中修改 IM SDK 的版本号。api "com.tencent.imsdk:imsdk-plus:7.9.5668"
build.gradle
文件的 buildscript -> dependencies 下添加以下配置:buildscript {dependencies {classpath 'com.google.gms:google-services:4.3.15'}}
build.gradle
文件中添加下方配置:apply plugin: 'com.google.gms.google-services'
proguard-rules.pro
文件中,将 TIMPush 相关类加入不混淆名单:-keep class com.tencent.qcloud.** { *; }-keep class com.tencent.timpush.** { *; }
build.gradle
文件,将应用包名修改为您的实际应用包名。applicationId 'com.****.callkit'
application
类中,监听 TIMPush 发出的事件通知,实现自动登录。TUICore.registerEvent(TUIConstants.TIMPush.EVENT_IM_LOGIN_AFTER_APP_WAKEUP_KEY, TUIConstants.TIMPush.EVENT_IM_LOGIN_AFTER_APP_WAKEUP_SUB_KEY, new ITUINotification() { @Override public void onNotifyEvent(String key, String subKey, Map<String, Object> param) { if (TUIConstants.TIMPush.EVENT_IM_LOGIN_AFTER_APP_WAKEUP_KEY.equals(key) && TUIConstants.TIMPush.EVENT_IM_LOGIN_AFTER_APP_WAKEUP_SUB_KEY.equals(subKey)) { //you need to login again to launch call activity, please implement this method by yourself autoLogin(); } } });
tuicallkit-kt/src/main/res/raw/phone_ringing.mp3
文件。fun requestPermission(context: Context?) {//In TUICallKit,Please open both OverlayWindows and Background pop-ups permission.PermissionRequester.newInstance(PermissionRequester.FLOAT_PERMISSION, PermissionRequester.BG_START_PERMISSION).request()}
手机 > 系统设置 > 应用管理 > 应用
中手动开启上述权限。Pixel 4a | VIVO |
| |
本页内容是否解决了您的问题?