Skip to main content

@napacitor/app-launcher

App launcher plugin wrapping the .NET MAUI Launcher and Map APIs: open other apps, URLs, and the system map.

Installation​

To use npm:

npm install @napacitor/app-launcher

To use yarn:

yarn add @napacitor/app-launcher

Sync native files:

npx nap sync

Usage​

import { AppLauncher } from '@napacitor/app-launcher';

// Open a URL
await AppLauncher.openUrl({ url: 'https://example.com' });

// Check whether the URL can be handled
const { canOpen } = await AppLauncher.canOpenUrl({ url: 'tel:1234567890' });

// Open an app by package name
await AppLauncher.openApp({ appId: 'com.example.app' });

// Check whether a specific app is installed
const { canOpen: appInstalled } = await AppLauncher.canOpenApp({ appId: 'com.example.app' });

// Open the system map
await AppLauncher.openMap({
latitude: 39.9042,
longitude: 116.4074,
label: 'Beijing',
navigationMode: 'driving',
});

How It Works​

Wraps the .NET MAUI Launcher.Default.OpenAsync / CanOpenAsync and Map.Default.OpenAsync facades. openApp / canOpenApp build a URI in the form <appId>:// and go through Launcher; openMap maps label to MapLaunchOptions.Name and navigationMode to NavigationMode (driving / walking / transit, anything else is None).

Permissions​

Android​

No additional configuration required. openUrl supports http/https/mailto/tel/geo and other protocols.

iOS​

No additional configuration required. To detect whether third-party app custom schemes can be opened, declare LSApplicationQueriesSchemes in Info.plist (subject to iOS query limits).

Windows​

No additional configuration required.

API​

openUrl(options)​

Opens a URL (handled by the system browser or the corresponding app). The URL must be a valid absolute address, otherwise INVALID_ARGUMENTS is thrown; opening is still attempted when the platform reports it cannot handle the URL (detection is unreliable on some platforms).

ParamType
optionsOpenUrlOptions

Returns: Promise<void>

canOpenUrl(options)​

Checks whether the current platform can handle the URL (returns false when the URL is invalid).

ParamType
optionsOpenUrlOptions

Returns: Promise<CanOpenUrlResult>

openApp(options)​

Opens an app by package name / app ID (tries <appId>://; throws UNSUPPORTED when the platform cannot handle it).

ParamType
optionsOpenAppOptions

Returns: Promise<void>

canOpenApp(options)​

Checks whether a specific app is installed (returns false when detection fails).

ParamType
optionsOpenAppOptions

Returns: Promise<CanOpenAppResult>

openMap(options)​

Opens the system map positioned at the given coordinates.

ParamType
optionsOpenMapOptions

Returns: Promise<void>

Interfaces​

OpenUrlOptions​

PropTypeDescription
urlstringURL to open (supports http/https/mailto/tel/geo and other protocols).

OpenAppOptions​

PropTypeDescription
appIdstringAndroid package name / iOS Bundle ID / Windows app protocol.

CanOpenUrlResult​

PropTypeDescription
canOpenbooleanWhether the current platform can handle the URL.

CanOpenAppResult​

PropTypeDescription
canOpenbooleanWhether the app is installed on the current platform.

OpenMapOptions​

PropTypeDescription
latitudenumberLatitude.
longitudenumberLongitude.
labelstringMap label (optional, maps to MapLaunchOptions.Name).
navigationModestringNavigation mode: driving / walking / transit (optional, only partially supported; anything else is treated as None).