Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lamnhan066/firebase_messaging_helper
https://github.com/lamnhan066/firebase_messaging_helper
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lamnhan066/firebase_messaging_helper
- Owner: lamnhan066
- License: gpl-3.0
- Created: 2022-08-03T02:48:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-04T16:57:53.000Z (over 2 years ago)
- Last Synced: 2023-10-05T09:00:41.314Z (about 1 year ago)
- Language: Dart
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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()}');
}```