initialize method
- dynamic firebaseMessaging,
- {String? vapidKey}
Initialize ParsePush; for web a vapidKey
is required.
Implementation
Future<void> initialize(
firebaseMessaging, {
String? vapidKey,
}) async {
// Get Google Cloud Messaging (GCM) token
firebaseMessaging
.getToken(vapidKey: vapidKey)
.asStream()
.listen((event) async {
// Set token in installation
sdk.ParseInstallation parseInstallation =
await sdk.ParseInstallation.currentInstallation();
parseInstallation.deviceToken = event;
parseInstallation.set(keyPushType, keyType);
await parseInstallation.save();
});
}