Last updated:
0 purchases
laravel notify fcm
Laravel Notify Fcm #
Laravel Notify Fcm is a package for sending notifications to your Flutter app using Laravel FCM.
Getting started #
Installation #
Add the following to your pubspec.yaml file:
dependencies:
laravel_notify_fcm: ^1.0.2
copied to clipboard
or with Dart:
dart pub add laravel_notify_fcm
copied to clipboard
Requirements #
Laravel
Laravel Sanctum
laravel-fcm-channel
Usage #
import 'package:laravel_notify_fcm/laravel_notify_fcm.dart';
copied to clipboard
Adding a device to the database #
First, call init to initialize the package.
Parameters:
url - The URL to your Laravel app where the package will send the device token.
firebaseMessaging - The FirebaseMessaging instance.
debugMode - Whether to enable debug mode. The default is false.
FirebaseMessaging firebaseMessaging = FirebaseMessaging.instance;
await LaravelNotifyFcm.instance.init(
url: 'https://example.com/api/fcm/devices',
firebaseMessaging: firebaseMessaging,
);
copied to clipboard
Then, call storeFcmDevice to add the device to the database.
await LaravelNotifyFcm.instance.storeFcmDevice(
sanctumToken: 'from your Laravel user',
);
copied to clipboard
This method will request permission to send notifications to the device. If the user accepts, the device will be added to the database.
View our docs on Laravel FCM Channel to start sending notifications.
Try the example app to see how it works.
Changelog #
Please see CHANGELOG for more information what has changed recently.
Social #
Twitter
Licence #
The MIT License (MIT). Please view the License File for more information.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.