Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lamnhan066/firebase_messaging_helper


https://github.com/lamnhan066/firebase_messaging_helper

Last synced: 7 days ago
JSON representation

Awesome Lists containing this project

README

        

# Firebase Messaging Helper

This plugin combine firebase_messaging with awesome_notification to help you esier to implement firebase notification.

## Setup

### - Apple integration: [Read here](https://firebase.flutter.dev/docs/messaging/apple-integration)

### - Android integration

Add the following `meta-data` schema within the `application` component:

``` xml

```

Add this intent-filter in AndroidManifest in the `` tag with `android:name=".MainActivity"`:

``` xml


```

## Usage

### Initialize plugin

``` dart
FirebaseMessagingHelper.initial(
/// Show a dialog before asking for the permission
preDialogConfig: PreDialogConfig(
context: context,
),

/// Callback when users tap on the notification
onTapped: (message) => print('tapped message = ${message.notification?.toMap()}'),

/// Callback when receving the notification on foreground
onForegroundMessage: (message) => print('foreground message = ${message.notification?.toMap()}'),

/// Callback when receving the notification on background
onBackgroundMessage: backgroundNotificationHandler,

/// Show debug log
isDebug: true,
);
```

The `backgroundNotificationHandler` must be static or top-level method (do not support anonymous method)

``` dart
Future backgroundNotificationHandler(RemoteMessage message) async {
print('On background message = ${message.notification?.toMap()}');
}

```