Configure the Experience

The SDK offers a simple interface that allows you to offer Experiences to your users in few lines of code.

An app can be configured to exist as an embed within a written article, rather like a widget. But you can also set the same app to display full page with its header and footer.

This section covers the available options:


Manage Dynamic Sizing

By default, the SDK will respect the height specified within your application and display a scrollbar when necessary so the user can navigate the full content.

However, the SDK can automatically manage the height of the view for you, by respecting the width set and updating the height to match that of the content in the app:

circle-exclamation
import {
  embed,
  getExperience,
} from '@monterosa/sdk-launcher-kit';

const exp = getExperience({
  autoresizesHeight: true
});

await embed(exp, 'container-id');

Respond to resizing

Additionally, the SDK lets you listen to changes in the intrinsic size of the web page, so you can handle the resize with your preferred approach:

Launch a specific Event

By default, the SDK will launch the app without specifying a specific event and will use the project's default Event.

If you want to launch to a specific event, you can do so by specifying the Event ID using the example below. To retrieve and determine the event you want, refer to Getting and displaying Events

Provide custom parameters

The SDK allows you to provide custom query parameters in LauncherKit to customise the app you embed. How the app responds depends on how it was created so this is general feature available for developers.

You can use it as follows:

Loading and Error Views

By default, the SDK will use the loading view from the app itself. You can enable a custom loading / error view by setting supportsLoadingState to true.

circle-info

On Android, loading and error views are not supported when using the ExperienceActivity and ExperienceFragment classes rather than ExperienceView as we can't parcelise the view providers.

Use instead an ExperienceView or wrap it with your own Activity or Fragment.

When enabled, a simple black-on-white loading screen is displayed so as to avoid having a blank screen whilst the app is loaded.

If you want to customise said views, you can do so by passing via ExperienceConfiguration a ViewProvider, which is responsible to create a view to display instead of the default loading/error views.

circle-exclamation

By default, the SDK assumes that the parent application will be displaying its own header and footer, and therefore we hide the app's default header if one exists. You can override this behaviour and present the header and footer of the app by using the following snippet:

Last updated