Live presentation: Ionic’s Security Trifecta: Mobile App Security Made Easy

DocsPluginsCLI

@capacitor/app-launcher

The AppLauncher API allows to open other apps

Install

npm install @capacitor/app-launcher
npx cap sync

Example

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

const checkCanOpenUrl = async () => {
  const { value } = await AppLauncher.canOpenUrl({ url: 'com.getcapacitor.myapp' });

  alert('Can open url: ', value);
};

const openPortfolioPage = async () => {
  await AppLauncher.openUrl({ url: 'com.getcapacitor.myapp://page?id=portfolio' });
};

API

canOpenUrl(…)

canOpenUrl(options: CanOpenURLOptions) => Promise<CanOpenURLResult>

Check if an app can be opened with the given URL.

On iOS you must declare the URL schemes you pass to this method by adding the LSApplicationQueriesSchemes key to your app’s Info.plist file. Learn more about configuring Info.plist.

This method always returns false for undeclared schemes, whether or not an appropriate app is installed. To learn more about the key, see LSApplicationQueriesSchemes.

Param Type
options CanOpenURLOptions

Returns: Promise<CanOpenURLResult>

Since: 1.0.0


openUrl(…)

openUrl(options: OpenURLOptions) => Promise<OpenURLResult>

Open an app with the given URL.

Param Type
options OpenURLOptions

Returns: Promise<OpenURLResult>

Since: 1.0.0


Interfaces

CanOpenURLResult

Prop Type
value boolean

CanOpenURLOptions

Prop Type
url string

OpenURLResult

Prop Type
completed boolean

OpenURLOptions

Prop Type
url string
Previous
<- App
Next
Browser ->
Contribute ->