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.
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:
Note: This feature only works with FanKit versions 24.33.0 or later. Non-FanKit applications may not support the behaviour.
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.
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.
Show or hide the app's header and footer
Note: This feature only works on FanKit versions 24.33.0 or later and may not be supported by non-FanKit apps.
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:
import {
embed,
getExperience,
onIntrinsicSizeChanged,
} from '@monterosa/sdk-launcher-kit';
const exp = getExperience();
onIntrinsicSizeChanged(exp, (width, height) => {
// Here you can update your size as needed
});
await embed(exp, 'container-id');
import {
embed,
getExperience,
onIntrinsicSizeChanged,
} from '@monterosa-sdk/launcher-kit';
const exp = getExperience();
onIntrinsicSizeChanged(exp, (width, height) => {
// Here you can update your size as needed
});
await embed(exp, 'container-id');
import {
embed,
getExperience,
} from '@monterosa/sdk-launcher-kit';
const eventId = '<event id>';
const experience = getExperience({
eventId,
// Other ExperienceConfiguration values can be added,
// such as autoresizesHeight, hidesHeadersAndFooters, etc...
});
await embed(experience, 'container-id');
import {
embed,
getExperience,
} from '@monterosa-sdk/launcher-kit';
const eventId = '<event id>';
const experience = getExperience({
eventId,
// Other ExperienceConfiguration values can be added,
// such as autoresizesHeight, hidesHeadersAndFooters, etc...
});
await embed(experience, 'container-id');