Fcm.configure constructor
Fcm.configure(
- BuildContext context
Implementation
Fcm.configure(BuildContext context){
Firebase.initializeApp();
notif = PushNotification.init(context);
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
onReceiveMessage(message);
});
debugPrint("Obtain firebase token");
_firebaseMessaging.getToken().then((String? token) {
debugPrint("Finish obtain token");
this.token = token;
SharedPref.setFcmRegId(token!);
Fcm.registerDeviceToServer();
});
}