腾讯云音视频通话SDKFlutter_音视频解决方案_同尘科技

音视频通话SDK 2年前 (2023-12-22) 浏览 123

离线唤醒功能,能够让您的 App 在后台运行或者离线状态下依然能够收到音视频通话的响铃呼叫,TUICallKit Flutter 需要依赖厂商: Apple、Google、Vivo、Xiaomi 提供的推送能力来进行消息通知。

配置离线推送

1. iOS

iOS 平台的离线唤醒支持APNsVoIP具体配置流程请参考:APNs 离线唤醒配置流程VoIP 离线唤醒配置流程

2. Android

Android 平台具体配置流程,请参考:离线推送(Flutter)。

自定义离线消息内容

在基础的离线推送配置成功后,您就可以正常收到对来电推送,如果您需要自定义离线消息的内容,可通过callgroupcall 接口中的参数 params 中的TUIOfflinePushInfo实现自定义通知内容,可以自定义的内容包括标题内容离线消息铃声等内容。具体使用如下:

Future call(String userId, TUICallMediaType callMediaType, [TUICallParams? params])
class TUICallParams { TUIOfflinePushInfo offlinePushInfo; // 离线消息信息}
class TUIOfflinePushInfo { String? title; //离线消息title String? desc; //离线消息内容 bool? ignoreIOSBadge; String? iOSSound; //iOS离线消息铃声 String? androidSound; //Android离线消息铃声 String? androidOPPOChannelID; //OPPO离线消息参数 int? androidVIVOClassification; //VIVO离线消息参数 String? androidXiaoMiChannelID; //小米离线消息参数 String? androidFCMChannelID; //FCM参数 String? androidHuaWeiCategory; //华为离线消息参数 bool? isDisablePush; //是否开启离线推送 TUICallIOSOfflinePushType? iOSPushType; //离线消息类型}}
enum TUICallIOSOfflinePushType { APNs, VoIP,}

自定义离线消息铃声

1. iOS

修改callgroupcall接口中的参数params中的TUIOfflinePushInfo.iOSSound设置iOS平台上的离线消息铃声。

2. Android

FCM

在完成第一步:配置离线推送之后,即可在离线的情况下收到消息推送,但是是默认的铃声,如果您需要支持自定义铃声,还需要进行如下操作:1、 在IM 控制台-基础配置,选择 Android 原生离线推送配置 -> 选择 Google 的证书进行编辑,添加 ChannelID,如下图所示
2、在工程的 android/app/src/main/res/raw/目录下,放入自定义的铃声文件,示例:”incoming_call.mp3’3、在登录成功之后,通过 `tim_ui_kit_push_plugin` 插件 向 Android 系统注册播放自定义铃音的 NotificationChannel,示例代码如下

void createNotificationChannel() {  AndroidNotificationChannelGroup group = new AndroidNotificationChannelGroup("GroupID", "GroupName");  AndroidFlutterLocalNotificationsPlugin plugin = AndroidFlutterLocalNotificationsPlugin();  plugin.createNotificationChannelGroup(group);
  AndroidNotificationChannel channel = AndroidNotificationChannel(      "fcm_push_channel", "ChannelName",      groupId: "GroupID",      importance: Importance.high,      enableLights: true,      enableVibration: true,      sound: RawResourceAndroidNotificationSound("incoming_call")); // Note: Media files do not need a suffix  plugin.createNotificationChannel(channel);}

联系我们

如遇到该问题,需要做兼容处理,您可以加入我们的 QQ 群(605115878)进行咨询与反馈。

对音视频的解决方案有疑惑?想了解解决方案收费? 联系解决方案专家

腾讯云限时活动1折起,即将结束: 马上收藏

同尘科技为腾讯云授权服务中心,购买腾讯云享受折上折,更有现金返利:同意关联,立享优惠

阿里云解决方案也看看?: 点击对比阿里云的解决方案

- 0人点赞 -

发表点评 (0条)

not found

暂无评论,你要说点什么吗?