Docs

Messages

In-app messaging and push notifications with the Grovs Flutter SDK

If console messages have automatic display enabled in your dashboard, they will appear in your app without any additional integration.

Push notifications

To receive push notifications for messages sent from the Grovs dashboard, pass the device token to the SDK.

Android (Firebase Cloud Messaging)

Follow the Firebase setup for Flutter to add FCM to your project, then pass the token:

Dart
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:grovs_flutter_plugin/grovs.dart';
 
final grovs = Grovs();
 
// Get and set the FCM token
final token = await FirebaseMessaging.instance.getToken();
if (token != null) {
  await grovs.setPushToken(token);
}
 
// Listen for token refreshes
FirebaseMessaging.instance.onTokenRefresh.listen((newToken) {
  grovs.setPushToken(newToken);
});

Upload your Firebase Service Account JSON key and Project ID in the Grovs dashboard under Android Setup → Push Notifications.

iOS (APNs)

  1. In Xcode, add the Push Notifications capability and enable Remote notifications under Background Modes
  2. Upload your APNs .p8 key, Key ID, and Team ID in the Grovs dashboard under Settings → Push Notifications
  3. Request permission and pass the token:
Dart
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:grovs_flutter_plugin/grovs.dart';
 
final grovs = Grovs();
 
// Request permission
final settings = await FirebaseMessaging.instance.requestPermission();
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
  // Get the APNs token (iOS) or FCM token
  final token = await FirebaseMessaging.instance.getToken();
  if (token != null) {
    await grovs.setPushToken(token);
  }
}

Push notifications require a physical device. They do not work in the iOS Simulator.