Example app
Build, run, and navigate the example app included with the Flutter SDK
The Exponea Flutter SDK includes an example application you can use as a reference implementation. You can build and run the app, test Engagement features, and compare the code and behavior of your implementation with the expected behavior and code in the example app.
Prerequisites
You must have the following software installed to be able to build and run the example app:
- Flutter SDK
- Git
- Android Studio with a virtual or physical device set up to run the app on Android
- Xcode and CocoaPods with a virtual or physical device set up to run the app on iOS
Follow Flutter's Get started guide if you are new to Flutter.
Build and run the example app
- Clone the exponea-flutter-sdk repository on GitHub:
git clone https://github.com/exponea/exponea-flutter-sdk.git - Enter the
exampledirectory containing the example app:cd exponea-flutter-sdk/example - To run the app on iOS:
- Run CocoaPods in the
iosdirectory to install dependencies:cd ios pod install cd .. - Connect a virtual or physical iOS device.
- Run the app:
flutter run
- Run CocoaPods in the
- To run the app on Android:
- Connect a virtual or physical Android device.
- Run the app:
Alternatively, use
flutter run --flavor gms--flavor hmsfor Huawei devices without GooglePlay services but with HMS Core.If you use Visual Studio Code, you can create a launch configuration to use the flavor flag.
To enable push notifications in the example app, you must also configure the Firebase integration or Huawei integration in the Exponea web app.
Navigate the example app

When you run the app in the simulator, you'll see the ConfigPage.
- Enter your project token, API token, and API base URL.
- Optionally, enter
Application IDif your Engagement project supports multiple mobile apps. If you leave this blank, the SDK uses the default value "default-application". Learn more about configuration. - Optionally, disable
Automatic Session Trackingusing the switch (default enabled). - Then click
Configureto initialize the SDK.
The HomePage provides several buttons to test the different SDK features.
-
In the
Push eventssection, you canRequest Push Authorizationand check whether push notifications areConfigured?. -
In the
Customersection, you can get the customer's soft ID (Get Cookie),Identifythe customer (using the hardcoded ID[email protected]), orAnonymizethe customer. -
In the
Fetchsection, you can fetch the customer'sConsentsandRecommendations. -
In the
Flush Modesection, you canGetandSetthe flush mode, and trigger a manualFlush. -
In the
Flush Periodsection, you can configure the flush period using the slider and theSetbutton. -
In the
Tracksection, you can track anEvent(a harcoded eventevent_namewith some sample properties) and, if you disabled automatic session tracking, you can manually trackSession StartandSession End. -
In the
Trigger in-app messages by eventsection, you can track various test events you can use to trigger in-app messages while testing:Modal(track atest_msg_modalevent)Fullscreen(track atest_msg_fullscreenevent)Slide-in(tracks atest_msg_slideevent)Alert(tracks atest_msg_alertevent)
-
In the
Log Levelsection, you canGetthe current log level. -
In the
App Inboxsection, you can access theApp Inbox,Fetch allmessages,Fetch firstmessage, andMark first as read. -
Using the
In App CB Example Pagebutton, you can access the InAppCbPage to test in-app content blocks. Use the placeholder IDsexample_topandexample_listfor the corresponding placeholders. Use the placeholder IDsph_x_example_iOSandph_x_example_Androidto test platform-specific content blocks in the placeholder labeled "platformSpecificPlaceholderId".
Try out the different features in the app, then find the customer profile in the Engagement web app (under Data & Assets > Customers) to see the properties and events tracked by the SDK.
By default, the customer is tracked anonymously using a cookie soft ID. You can look up the cookie value in the logs and find the corresponding profile in the Engagement web app.
If you used the Identify button, the customer can be found in Engagement web app by the test email address ([email protected]).
Refer to Customer Identification for more information on soft IDs and hard IDs.

Troubleshooting
If you encounter any issues running the example app, the following may help:
- In the
exampledirectory, runflutter clean, thenflutter pub get. - If the app doesn't start on Android, you may have forgotten to include the
--flavor gmsor--flavor hmsflag.
Updated 5 days ago
