createNotificationChannel method

  1. @override
Future<bool> createNotificationChannel({
  1. required String channelId,
  2. required String channelName,
  3. String? channelDescription,
  4. int? importance,
  5. bool? enableLights,
  6. bool? enableVibration,
  7. String? sound,
})
override

设置通知渠道

Implementation

@override
Future<bool> createNotificationChannel({
  required String channelId,
  required String channelName,
  String? channelDescription,
  int? importance,
  bool? enableLights,
  bool? enableVibration,
  String? sound,
}) async {
  try {
    final result = await methodChannel.invokeMethod<bool>('createNotificationChannel', {
      'channelId': channelId,
      'channelName': channelName,
      'channelDescription': channelDescription,
      'importance': importance,
      'enableLights': enableLights,
      'enableVibration': enableVibration,
      'sound': sound,
    });
    return result ?? false;
  } catch (e) {
    debugPrint('HuaweiPush createNotificationChannel error: $e');
    return false;
  }
}