App

This integration is used to handle some basic calls to the app.

Introduction

This integration is used to handle some basic calls to the app.

Where to find: startiapp.App

Methods

isStartiappLoaded

isStartiappLoaded(): boolean

Has the app told the site it has been initialized and is ready for interaction with the site?

Note: The difference between isRunningInApp and isStartiappLoaded is that isRunningInApp is true whenever the site is loaded inside the app, but isStartiappLoaded is first set to true when the app is fully launched and ready for interaction with the site.

setAppUrl

setAppUrl: (url: string) => void

Use this method to control which URL the app load when it is initialized.

resetAppUrl

resetAppUrl(): void

Call this method to reset the startup URL of the app. After calling this method the app will load the URL it was “born” with after a restart. Please notice that this URL can be different between the test and production environment.

version

version(): Promise<string>

Returns the version number of the app (eg. 1.0.0).

requestReview

requestReview(): void

Request a review of the app.

disableScreenRotation

disableScreenRotation(): void

Locks the screen orientation to portrait.

enableScreenRotation

enableScreenRotation(): void

Unlocks the screen orientation.

disableSwipeNavigation

disableSwipeNavigation(): void

Disables the swipe navigation. (This includes the back button on some android launchers)

enableSwipeNavigation

enableSwipeNavigation(): void

Enables the swipe navigation. (This includes the back button on some android launchers)

openExternalBrowser

openExternalBrowser: (url: string) => void

Opens the given URL in the default browser.

showStatusBar

showStatusBar: () => void

Show the status bar.

hideStatusBar

hideStatusBar: () => void

Hide the status bar.

setSafeAreaBackgroundColor

setSafeAreaBackgroundColor(color: string): void

Set the background color of safe area. This is the area that is not covered by the app. The color is set in the format #RRGGBB

addEventListener

addEventListener(type: AppEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void

Listen for events.

removeEventListener

removeEventListener(type: AppEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void

Remove event listener.

getInternalDomains

getInternalDomains(): Promise<string[]>

Returns a list of all internal domains.

addInternalDomain

addInternalDomain(domain: string): void

Adds a domain to the list of internal domains.

removeInternalDomain

removeInternalDomain(domain: string): void

Removes a domain from the list of internal domains.

setAppIcon

setAppIcon(iconName: string): void

Changes the app-icon to the specified icon.

This function requires the White Label module.


Events

How to listen for events.

appInForeground

appInForeground

The event will be called whenever the app enters the foreground on the device and when the app starts og thus also enters the foreground on the device.