Closed NoldyNayoan closed 3 years ago
The main purpose of this package is to show head up notification while in foreground
any way you still can do what you need as next
init as next
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
// This will show notification on background
FCMConfig.displayNotification(title: message.data["title"], body: message.data["body"],data:message.data);
}
void main() async {
FCMConfig.init(onBackgroundMessage: _firebaseMessagingBackgroundHandler);
runApp(MaterialApp(
home: MyScreen(),
));
}
to show your widget in foreground
class MyScreen extends StatefulWidget {
@override
_MyScreenState createState() => _MyScreenState();
}
class _MyScreenState extends State<MyScreen>
with FCMNotificationMixin {
@override
Widget build(BuildContext context) {
return MaterialApp(
//.....
);
}
@override
void onNotify(RemoteMessage notification) {
// here you can show your own widget
}
}
hope this help you
Hi, how to display my own message widget, if my app is in foreground?