showLiveActivity method
Future<bool>
showLiveActivity({
- required int id,
- required String channelId,
- required String channelName,
- String? title,
- String? body,
- String? subText,
- int? progress,
- bool indeterminate = false,
- bool ongoing = true,
- String? payload,
override
Post or update an Android live ongoing notification (the Android equivalent
of an iOS Live Activity). Uses a promoted Live Update (ProgressStyle) on
Android 16+, a normal ongoing notification with a progress bar otherwise.
Returns true if shown.
Implementation
@override
Future<bool> showLiveActivity({
required int id,
required String channelId,
required String channelName,
String? title,
String? body,
String? subText,
int? progress,
bool indeterminate = false,
bool ongoing = true,
String? payload,
}) async {
try {
final ok = await methodChannel.invokeMethod<bool>('showLiveActivity', {
'id': id,
'channelId': channelId,
'channelName': channelName,
'title': title,
'body': body,
'subText': subText,
'progress': progress,
'indeterminate': indeterminate,
'ongoing': ongoing,
'payload': payload,
});
return ok ?? false;
} catch (_) {
return false;
}
}