createAndroidChannel method

  1. @override
Future<Map> createAndroidChannel(
  1. String id,
  2. String name,
  3. int importance,
  4. String description, {
  5. String? groupId,
  6. bool? allowBubbles,
  7. bool? light,
  8. int? lightColor,
  9. bool? showBadge,
  10. String? soundPath,
  11. int? soundUsage,
  12. int? soundContentType,
  13. int? soundFlag,
  14. bool? vibration,
  15. List<int>? vibrationPatterns,
})
override

创建 Android 平台的NotificationChannel

Implementation

@override
Future<Map<dynamic, dynamic>> createAndroidChannel(
  String id,
  String name,
  int importance,
  String description, {
  String? groupId,
  bool? allowBubbles,
  bool? light,
  int? lightColor,
  bool? showBadge,
  String? soundPath,
  int? soundUsage,
  int? soundContentType,
  int? soundFlag,
  bool? vibration,
  List<int>? vibrationPatterns,
}) async {
  if (!Platform.isAndroid) {
    return {
      'code': kAliyunPushOnlyAndroid,
      'errorMsg': 'Only support Android',
    };
  }

  Map<dynamic, dynamic> result =
      await methodChannel.invokeMethod('createChannel', {
    'id': id,
    'name': name,
    'importance': importance,
    'desc': description,
    'groupId': groupId,
    'allowBubbles': allowBubbles,
    'light': light,
    'lightColor': lightColor,
    'showBadge': showBadge,
    'soundPath': soundPath,
    'soundUsage': soundUsage,
    'soundContentType': soundContentType,
    'soundFlag': soundFlag,
    'vibration': vibration,
    'vibrationPatterns': vibrationPatterns,
  });
  return result;
}