패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.2.0

flutter_notification_channel

안드로이드에서 알림 채널을 설정하기 위한 플러그인

AndroidiOS
30일 다운로드
3.9천
좋아요
33
Pub 점수
120

패키지 설치

flutter pub add flutter_notification_channel

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

flutter_notification_channel 패키지는 Flutter 애플리케이션 내에서 Android 기기의 알림 채널을 쉽게 구성하고 관리할 수 있도록 도와줍니다. 이 패키지는 알림 채널을 생성, 업데이트 및 사용자 정의할 수 있는 간단한 API를 제공하여, Android의 알림 채널 요구 사항에 따라 알림이 올바르게 분류되고 표시되도록 보장합니다. 이 패키지는 Android 및 iOS 플랫폼을 모두 지원하지만, 주로 Android의 채널 기반 알림 시스템에 초점을 맞추고 있습니다. 소리, 진동, 중요도 수준 등의 알림 동작에 대해 세밀한 제어를 가능하게 하여 사용자 경험을 향상시킵니다.

사용 사례

  • 사용자 정의 알림 채널 구성
  • 알림 중요도 수준 관리
  • 알림 소리 및 진동 사용자 지정
  • Android 8.0 이상 알림 요구 사항 준수 보장
  • 정리된 알림을 통한 사용자 경험 향상

주요 기능

  • 알림 채널을 생성하기 위한 간단한 API
  • Android 8.0 이상 채널 요구 사항 지원
  • 크로스 플랫폼 호환성 (Android 및 iOS)
  • 중요도 및 사운드와 같은 구성 가능한 채널 속성
  • 기존 알림 시스템과의 간편한 통합

적합한 대상

  • 구조화된 알림 관리를 필요로 하는 앱
  • Android 8.0 이상 기기 대상 개발자
  • 사용자 정의 알림 동작이 필요한 프로젝트
  • 여러 가지 알림 유형을 가진 앱을 개발하는 팀
  • 푸시 알림을 사용하는 플러터 앱

고려 사항

  • 주요 기능은 Android에 국한되어 있습니다
  • iOS 지원은 제한적입니다 (채널 생성 없음)
  • 플랫폼별 로직을 수동으로 처리해야 합니다
  • 오래된 Android 버전에서 기본 알림에는 필요하지 않습니다
  • 다른 알림 플러그인과 함께 사용하는 것이 가장 좋습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_notification_channel

https://pub.dev/packages/flutter_notification_channel

This plugin is made to register notification channels with custom configurations on Android. For more details read this https://developer.android.com/training/notify-user/channels Why is it necessary? E.g. firebase_messaging version 7.0.3 (current) and lower do not allow to set up a notification channel, thus notifications don't play any sounds or do not display on locked screen, or don't bubble and so on. This plugin is made merely for the purpose of creation a notification channel with custom configurations on Android. The channels then can be used along with firebase_messaging.

How to use

Simply call it like this

var result = await FlutterNotificationChannel().registerNotificationChannel(
    description: 'Your channel description',
    id: 'your_channel_id',
    importance: NotificationImportance.IMPORTANCE_HIGH,
    name: 'Your channel name',
    visibility: NotificationVisibility.VISIBILITY_PUBLIC,
    allowBubbles: true,
    enableVibration: true,
    enableSound: true,
    showBadge: true,
);
print(result);

Importance Levels

The plugin supports the following notification importance levels:

  • NotificationImportance.IMPORTANCE_MIN (1): Minimal importance, might not be shown
  • NotificationImportance.IMPORTANCE_LOW (2): Low importance, shows in shade and potentially status bar but not audibly intrusive
  • NotificationImportance.IMPORTANCE_DEFAULT (3): Default importance, shows everywhere and makes noise but doesn't visually intrude
  • NotificationImportance.IMPORTANCE_HIGH (4): Higher importance, shows everywhere, makes noise and peeks, may use full screen intents
  • NotificationImportance.IMPORTANCE_MAX (5): Maximum importance, most intrusive level, should be used sparingly for critical notifications only
Example with Maximum Importance

For critical notifications that require immediate user attention:

var result = await FlutterNotificationChannel().registerNotificationChannel(
    description: 'Critical system alerts',
    id: 'critical_channel_id',
    importance: NotificationImportance.IMPORTANCE_MAX,
    name: 'Critical Alerts',
    visibility: NotificationVisibility.VISIBILITY_PUBLIC,
    allowBubbles: true,
    enableVibration: true,
    enableSound: true,
    showBadge: true,
);

Then, when you send a message to firebase like this, specify your android_channel_id and sound: "default" in order to play a default sound if you set "enableSound" in plugin. If you don't do this, the sound wont play at all on android 9 (I have no idea why)

{
  "notification": {
    "title": "Your message title",
    "body": "Your message body",
    "android_channel_id": "your_channel_id",
    "sound": "default"
  },
  "data": {
    "click_action" : "FLUTTER_NOTIFICATION_CLICK",
  },
  "priority": "high",
  "content_available": true,
  "to": "YOUR_FIREBASE_PUSH_TOKEN_GOES_HERE"
}

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.1.8

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.