Skip to content

Instantly share code, notes, and snippets.

@husen-hn
Created May 29, 2021 18:36
Show Gist options
  • Save husen-hn/995324ae820523051d1afd48b01d43a4 to your computer and use it in GitHub Desktop.
Save husen-hn/995324ae820523051d1afd48b01d43a4 to your computer and use it in GitHub Desktop.
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
if (message.data['message'] == 'Calling message') {
showCallNotification(
3, message.data['chatroomid'], message.data['userName']);
}
await Firebase.initializeApp();
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await firebase_core.Firebase.initializeApp();
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
runApp(MyApp());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment