Get started with Firebase In-App Messaging
Notice
This page is archived and might not reflect the latest version of the FlutterFire plugins. You can find the latest information on firebase.google.com:
https://firebase.google.com/docs/in-app-messaging/get-started?platform=flutter
This quickstart shows you how to set up Firebase In-App Messaging and send your first message.
#
Before you beginInstall and initialize the Firebase SDKs for Flutter if you haven't already done so.
#
Add the Firebase In-App Messaging SDK to your projectFrom the root directory of your Flutter project, run the following command to install the Firebase In-App Messaging plugin:
Rebuild your project:
Import the Firebase In-App Messaging plugin:
#
Send a test message#
Get your app's installation IDTo conserve power, Firebase In-App Messaging only retrieves messages from the server once per day. That can make testing difficult, so the Firebase console allows you to specify a test device that displays messages on demand.
That testing device is determined by a FID. Find your testing app's FID by checking the console output when you run your app.
On Android, the message looks like the following:
On iOS, run the app with the runtime command argument -FIRDebugEnabled
:
- With your Xcode project open, select Product > Scheme > Edit scheme... from the top menu bar.
- Open the Arguments tab of the dialog that pops up.
- Click + Add items under Arguments Passed On Launch.
- Enter "-FIRDebugEnabled" in the newly-created field.
- Click Close, then run your app.
Once your app starts running, look for the following line in the Xcode console's logs:
#
Send a message to your testing deviceOnce you've launched your app on the testing device and you have its Firebase installation ID (FID), you can try out your Firebase In-App Messaging setup by sending a test message:
- In the Firebase console, open In-App Messaging.
- Click New Campaign.
- Enter a Title for your first message.
- Click Test on your Device
- Enter your app's Firebase installation ID in the Add an installation ID field.
- Click Test to send the message.
Firebase In-App Messaging sends your test message as soon as you click Test. To see the message, you need to close, then reopen the app on your testing device.
To confirm whether your device is a test device, look for one of the following log messages.
Android
iOS