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

패키지 상세v1.3.6

flutter_fcm

Firebase Cloud Messaging (FCM)용 Flutter 플러그인으로, Android 및 iOS에서 신뢰할 수 있게 메시지를 전달할 수 있는 크로스플랫폼 메시징 솔루션입니다.

AndroidiOSmacOS
30일 다운로드
177
좋아요
41
Pub 점수
140

패키지 설치

flutter pub add flutter_fcm

패키지 개요

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

Flutter FCM는 Android, iOS 및 macOS에서 Firebase Cloud Messaging (FCM)를 사용하여 크로스 플랫폼 푸시 알림을 가능하게 하는 Flutter 플러그인입니다. 개발자는 사용자 기기로 알림과 데이터 페이로드를 포함한 메시지를 신뢰할 수 있게 전송할 수 있습니다. 이 플러그인은 토큰 관리, 메시지 수신 및 백그라운드 처리를 위한 간단한 API를 제공함으로써 FCM와의 통합을 간소화합니다. 프론트그라운드 및 백그라운드 메시지 전달을 모두 지원하여 실시간 앱 업데이트와 사용자 참여에 이상적입니다. Firebase와의 사용을 고려해 설계되어 여러 플랫폼에서 푸시 알림의 설정 및 관리를 간편하게 만듭니다.

사용 사례

  • 실시간 알림 보내기
  • 푸시 알림을 통한 사용자 참여
  • 백그라운드 메시지 처리
  • 앱 상태 동기화
  • 원격 구성 업데이트

주요 기능

  • 크로스 플랫폼 지원 (Android, iOS, macOS)
  • 토큰 관리 유틸리티
  • 프론트그라운드 및 백그라운드 메시지 처리
  • 메시지 수신을 위한 간단한 API
  • Firebase 콘솔과의 통합

적합한 대상

  • 푸시 알림이 필요한 앱
  • 실시간 메시징 기능
  • Firebase 통합 프로젝트
  • 다양한 플랫폼을 대상으로 하는 모바일 앱
  • 사용자 참여 캠페인

고려 사항

  • Firebase 프로젝트 설정이 필요합니다
  • 각 플랫폼에서 적절한 권한이 필요합니다
  • iOS의 백그라운드 실행 제한
  • FCM 서버 가용성에 따라 다름
  • 일부 플랫폼에서 알림 표시를 수동으로 처리해야 함

원본 README

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

Firebase Messaging Plugin for Flutter

A Flutter plugin to use the Firebase Cloud Messaging API.

To learn more about Firebase Cloud Messaging, please visit the Firebase website

Getting Started

To get started with Firebase Cloud Messaging for Flutter, please see the documentation.

Why flutter_fcm?

  • 🚀 Easy to use
  • ❤ Supports local notification
  • 🛡️ Null safety
  • ⚡ On notification Received/Pressed works in all states: foreground,background and even when app is closed(not running)

Getting Started

To get started with Firebase Cloud Messaging for Flutter, see Android Installation. and iOS Installation.

Usage

The easiest way to use this library is via the top-level functions.


import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter_fcm/flutter_fcm.dart';

class Messaging {
  static String? token;

  static deleteToken() {
    Messaging.token = null;
    FCM.deleteRefreshToken();
  }
  static subscribeToTopic(String topic) {
    FCM.subscribeToTopic(topic);
  }
  static unsubscribeFromTopic(String topic) {
    FCM.unsubscribeFromTopic(topic);
  }

  @pragma('vm:entry-point')
  static Future<void> onNotificationReceived(RemoteMessage message) async {
    await Firebase.initializeApp();
    //print('Handling a message ${message}');

  }

  @pragma('vm:entry-point')
  static initFCM() async {
    try {
      await Firebase.initializeApp(
          options: DefaultFirebaseOptions.currentPlatform
      );
      await FCM.initializeFCM(
        withLocalNotification: true,
        // navigatorKey: Keys.navigatorKey,
        onNotificationReceived: onNotificationReceived,
        onNotificationPressed: (Map<String, dynamic> data) {

        },
        onTokenChanged: (String? token) {
          if (token != null) {
            //print('FCM token  $token');
            Messaging.token = token;


          }
        },
        // TODO add this icon to android/app/src/main/res/drawable/ic_launcher.png
        icon: 'ic_launcher',
      );
    } catch (e) {
      print(e);
    }
  }
}

카테고리

의존성

의존성 목록 3 개

소스 저장소

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

아직 데이터가 없습니다.