setAndroidNotification static method
Implementation
static Future<dynamic> setAndroidNotification({
String? channelID,
String? title,
String? message,
String? icon,
String? actionText,
OptLocationCallback? actionCallback,
}) async {
if (Platform.isAndroid) {
var callback = 0;
notificationActionCallback = actionCallback;
if (actionCallback != null) {
try {
callback = PluginUtilities.getCallbackHandle(actionCallback)?.toRawHandle() ?? 0;
} catch (ex, stack) {
log('Error getting callback handle', error: ex, stackTrace: stack);
}
}
var data = <String, dynamic>{
'channelID': channelID,
'title': title,
'message': message,
'icon': icon,
'actionText': actionText,
'actionCallback': callback,
};
try {
return await _channel.invokeMethod('set_android_notification', data);
} catch (ex, stack) {
log('Error setting notification', error: ex, stackTrace: stack);
return await const MethodChannel(backgroundChannelID).invokeMethod('set_android_notification', data);
}
} else {
//return Promise.resolve();
}
}