tencent cloud

文档反馈

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

    配置离线推送

    iOS

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

    Android

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

    自定义离线消息内容

    在基础的离线推送配置成功后,您就可以正常收到对来电推送,如果您需要自定义离线消息的内容,可通过callgroupcall 接口中的参数 params 中的TUIOfflinePushInfo实现自定义通知内容,可以自定义的内容包括标题内容离线消息铃声等内容。具体使用如下:
    Future<void> call(String userId, TUICallMediaType callMediaType, [TUICallParams? params])
    
    class TUICallParams {
    TUIOfflinePushInfo offlinePushInfo;
    }
    
    class TUIOfflinePushInfo {
    String? title;
    String? desc;
    bool? ignoreIOSBadge;
    String? iOSSound;
    String? androidSound;
    String? androidOPPOChannelID;
    int? androidVIVOClassification;
    String? androidXiaoMiChannelID;
    String? androidFCMChannelID;
    String? androidHuaWeiCategory;
    bool? isDisablePush;
    TUICallIOSOfflinePushType? iOSPushType;
    }}
    
    enum TUICallIOSOfflinePushType {
    APNs,
    VoIP,
    }

    自定义离线消息铃声

    iOS

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

    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);
    }
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持