Flutter Push Notifications for iOS & Android
Dart, Flutter 3.22+. Built on firebase_messaging and flutter_callkit_incoming.
💙 Flutter
Dart, Flutter 3.22+. Built on firebase_messaging and flutter_callkit_incoming.
The SDK is free and open source (MIT) on GitHub. Create a free account to get your App ID.
Add the package
Set up Firebase with
flutterfire configure, then runflutter pub add firebase_core tingpush(the tingpush package on pub.dev), or declare:pubspec.yaml# pubspec.yaml dependencies: firebase_core: ^4.0.0 tingpush: ^1.1.1
Android: upload the service account JSON of the same Firebase project to TingPush. iOS: the server sends straight to APNs, so you need a .p8 key.
Initialize in main.dart
lib/main.dartimport 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:tingpush/tingpush.dart'; import 'firebase_options.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); await TingPush.initialize( appId: 'YOUR_APP_ID', callStyle: const TingPushCallStyle(appName: 'MyApp'), // omit if you don't use calls ); runApp(const MyApp()); }The SDK registers the background handler (to ring while the app is closed) and shows notifications while the app is open. APNs environment: debug/profile = sandbox, release = production (override with
iosSandbox).Handle notification & call events
Listen anywhere (e.g. your root screen's
initState): events that happen before you listen — like a notification tap that launched the app — are kept and delivered as soon as you do.Dart// User tapped a notification (even when the app was closed) TingPush.onNotificationOpened.listen((n) { // navigate using n.data['screen']... }); // Notification received while the app is open TingPush.onNotificationReceived.listen((n) { /* n.title, n.body, n.data */ }); // Call events TingPush.onCallEvent.listen((e) { if (e.action == TingPushCallAction.accepted) { // User tapped Answer → connect the call (e.call.id, e.call.data['room']) } });Assign the user at login
Dartawait TingPush.login('user-123'); // after login await TingPush.logout(); // on logout await TingPush.setTags({'plan': 'vip'}); await TingPush.endCall(callId); // end the calliOS: enable capabilities
Open
ios/Runner.xcworkspace→ Signing & Capabilities: add Push Notifications and Background Modes → Remote notifications (plus Voice over IP if you use calls). No AppDelegate changes needed.Requires iOS 15+. Calls on a locked Android phone: add
android:showWhenLocked="true"andandroid:turnScreenOn="true"to<activity android:name=".MainActivity">; on Android 14+ checkTingPush.canUseFullScreenIntent().
✅ After integrating, check
- Run the app on a real device with logging on: you should see
[TingPush] Device registered …. - The project's Devices tab: the device appears; iOS devices show the VoIP badge if you use calls.
- The Send tab: send a test to that device.
- Choose 📞 Call and test with the app open, closed and with the screen locked.