Skip to main content

Launch External Urls, Google Maps & Device Timers

Launch External Urls, Google Maps & Device Timers

Use this component to launch google maps based on passed address and latitude/longitude, and launch external urls via the browser. Device Timers are also available for looping actions

To get started using it, you must use KmpLauncher. All functions are thread safe and main thread safe.

Device Timers

KmpLauncher has two functions to invoke device timers. This allows you to pass an action that the device will run after a TimeSpan (in Seconds) that you pass it. So for example, to print a text into the Console every 2 seconds, you would use the following:


_5
KmpLauncher.startTimerRepeating(2){
_5
// returning false will stop the next iteration of the looping
_5
// true continues to the next iteration (meaning the action continues looping)
_5
return false
_5
}

To run an action that runs once, after a certain TimeSpan (Seconds) use the following. Below is an example, that runs the action after a 2 second delay, then stops.


_6
KmpLauncher.startTimer(2){
_6
// returning false will stop the next iteration of the looping
_6
// true continues to the next iteration (meaning the action continues looping)
_6
_6
return false
_6
}

Launch Apple/Google Maps for Navigation

To launch the device's internal Google/Apple maps app for Navigation, please use the following:


_19
/**
_19
* Launches the native maps app with directions. Navigates the user to address.
_19
* @param address the full address to direct the user to
_19
* */
_19
KmpLauncher.launchExternalMapsAppWithAddress(
_19
address: String,
_19
markerTitle: String = ""
_19
)
_19
_19
/**
_19
* Launches the native maps app with directions.
_19
* @param latitude Latitude of the Address
_19
* @param longitude Longitude of the address
_19
* */
_19
KmpLauncher.launchExternalMapsAppWithCoordinates(
_19
latitude: Double,
_19
longitude: Double,
_19
markerTitle: String = ""
_19
)

Launch External Urls or Device's Settings App

To launch any external url via the browser or share bottom sheet, please use:


_2
KmpLauncher.launchExternalUrlViaBrowser(linkPath: String)
_2
KmpLauncher.launchExternalUrlViaAnyApp(linkPath: String)

To launch device's internal settings (where users can configure app permissions, or app settings):


_1
KmpLauncher.launchAppInternalSettings()

Launch AppStore Review for your App


_4
/**
_4
* Launches app via app store Link (iOS requires an app store Identifier to work)
_4
* */
_4
KmpLauncher.launchAppStoreViaIdentifier(appStoreLink: String)

Any Setup Required?

None