Menu

Flutter

Last updated: 2023-09-19 15:11:23Download PDF
The offline wake-up function allows your app to receive ringtone calls for audio and video calls while running in the background or in offline mode. TUICallKit Flutter relies on the push capabilities provided by manufacturers: Apple, Google, Vivo, and Xiaomi for message notifications.


Configure offline push

1. iOS

iOS platform's offline wake-up support for APNs and VoIP, please refer to the specific configuration process:
VoIP offline wake-up configuration process(VoIP is temporarily not supported since version 1.8.0.)

2. Android

For the specific configuration process on the Android platform, please refer to: Offline Push (Flutter).

Customize offline message content

After the basic offline push configuration is successful, you can receive incoming call push notifications normally. If you need to customize the content of offline messages, you can use the params in the call and groupcall interfaces, and the TUIOfflinePushInfo to customize notification content, including title, content, and offline message ringtone. Specific usage as follows:
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,
}



Customize offline message ringtone

1. iOS

Modify the params in the call and groupcall interfaces, and set the TUIOfflinePushInfo.iOSSound for the offline message ringtone on the iOS platform.

2. Android

FCM

After completing step 1: Configure offline push, you can receive message push notifications even when offline, but it is the default ringtone. If you need to support custom ringtones, you need to perform the following operations:
1、In the IM console-basic configuration, select Android native offline push configuration -> select Google certificate for editing, add ChannelID, as shown in the following figure.



2、Add custom ringtone files to the android/app/src/main/res/raw/ directory of your project, such as "incoming_call.mp3".
3、After a successful login, use the tim_ui_kit_push_plugin plugin to register a NotificationChannel for playing custom ringtones to the Android system. Sample code as follows:
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);
}