Example app

Build, run, and navigate the example app included with the MAUI SDK

The Bloomreach MAUI 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:

Build and run the example app

  1. Clone the bloomreach-maui-sdk repository on GitHub:
    git clone https://github.com/exponea/bloomreach-maui-sdk.git
    
  2. Enter the bloomreach-maui-sdk directory:
    cd bloomreach-maui-sdk/
    
  3. To build the app for iOS:
    1. Enter the BloomreachSDKMauiIOS directory:
      cd BloomreachSDKMauiIOS
      
    2. Run CocoaPods to install dependencies:
      pod install
      
    3. Run the script to build frameworks:
      ./buildFramework.sh
      
  4. To build the app for Android:
    1. Enter the BloomreachSDKMauiAndroid directory:
      cd BloomreachSDKMauiAndroid
      
    2. Run Gradle to build the Android library:
      ./gradlew clean build
      
  5. Open ExampleApp.slb in Visual Studio.
  6. In the Visual Studio solution explorer, select ExampleApp (root) and run Restore NuGet Packages from the context menu.
  7. Open the Build menu and select Clean all.
  8. Select the target device in the top of the Visual Studio screen.
  9. Click on the Run (triangle) button for the ExampleApp module.

📘

To enable push notifications in the example app, you must also configure the Apple Push Notification Service integration (for iOS) or the Firebase integration or Huawei integration (for Android) in the Exponea web app.

Navigate the example app

Example app screens (Android)

When you run the app in the simulator, you'll see the LoginPage. Enter your project token, API token, and API base URL. Optionally, disable Auto Session Tracking using the switch (default enabled) and select a flush mode (default Immediate). Then click Configure to initialize the SDK.

LoginPage.xaml
LoginPage.xaml.cs

The MainPage provides several buttons to test the different SDK features.

MainPage.xaml
MainPage.xaml.cs

  • Show Configuration opens a screen listing several SDK configuration parameters including Auto session tracking, Flush mode, Flush period, Log level, and Default properties.

    ConfigInfoPage.xaml
    ConfigInfoPage.xaml.cs

  • Track custom event tracks a custom_event event. Track payment tracks a payment event with some dummy product and payment data.

  • Register for push notifications requests the user's permission to receive push notifications. Track push delivered tracks a campaign event with status "delivered". Track push clicked tracks a campaign event with status "clicked".

  • Anonymize calls the anonymize function for the current customer. Flush performs a manual data flush.

  • Identify Customer lets you enter a hard ID (registered) and one customer property name and value pair to identify the current customer.

  • Inbox opens the App Inbox screen. Fetch AppInbox fetches all App Inbox messages, while Fetch AppInbox Item fetches the first message only.

  • Fetch Consents fetches the customer's consents.

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, displayed at the top of the main screen. You can find the corresponding profile in the Engagement web app.

Once you use Identify Customer in the app to set the registered hard ID (use an email address as value), the customer is identified and can be found in Engagement web app by their email address.

📘

Refer to Customer Identification for more information on soft IDs and hard IDs.

Example app screens (iOS)

Troubleshooting

Error APT2260: resource mipmap/appicon_example (aka com.exponea.example:mipmap/appicon_example) not found

This happens occasionally because building is done in parallel steps and sometimes compilation finishes sooner than resource processing.

Repeat the steps Restore NuGet Packages, Build > Clean All, run ExampleApp.

Error: Could not find any available provisioning profiles for ExampleApp on iOS

To be able to run the app on iOS from Visual Studio, you need to have a valid Apple Developer Account and a provisioning profile for the app's Bundle ID linked to the account. The default Bundle ID of the example app (com.exponea.ExponeaSDK-Example2) is already assigned to the SDK development team, you must create a new unique Bundle ID for your account and use that for the example app.

  1. Add your Apple Developer Account to Xcode. Select Xcode > Settings > Accounts, add your Apple Developer Account and select the appropriate team (if applicable).
  2. Create a new dummy iOS app in Xcode. Select the app and on the Signing & Capabilities tab, make sure that:
    1. Automatically manage signing is checked
    2. The appropriate Team is selected.
    3. The Bundle Identifier is something unique and available.
  3. Run the dummy app on the iOS simulator. This will create the provisioning profile for the Bundle ID.
  4. Add your Apple Developer Account to Visual Studio. Select Visual Studio > Preferences > Publishing > Apple Developer Accounts, add your Apple Developer Account and select the appropriate team (if applicable).
  5. Open ExampleApp.sln in Visual Studio. Open ExampleApp/Platforms/iOS/Info.plist and change the Bundle identifier to the same one you used for the dummy app in Xcode.
  6. Follow the steps for iOS in . The app should now run on the iOS simulator.