background_push_notification
A Flutter plugin to handle background push notifications seamlessly across Android.
It allows apps to receive and process notifications even when the app is terminated or in the background.
Features
- 📩 Receive push notifications in the background.
- âš¡ Works when app is killed, minimized, or running in the background.
- 📱 Android support.
- 🔧 Easy to integrate with existing Firebase/Push notification setup.
Installation
step 1: Add the dependency to your pubspec.yaml:
dependencies: background_push_notification: ^1.0.0
step 2: flutter pub get
step 3: Import Plugin import 'package:background_push_notification/background_push_notification.dart';
example main.dart
void main() { WidgetsFlutterBinding.ensureInitialized();
BackgroundPushNotification.initialize( onBackgroundMessage: (message) { // Handle background message print("Background Message: $message"); }, );
runApp(const MyApp()); }
BackgroundPushNotification.onMessage.listen((message) { print("Foreground Message: $message"); });