Skip to main content

canLaunchApp

Description

Reports through a callback whether an external app can be launched with a URL scheme.

The result comes back asynchronously: the first argument of the callback function receives true (can launch) or false (cannot). If URL parsing fails or an exception occurs, it also passes false.

Parameters

ParameterTypeDescription
urlSchemeStringURL or URL scheme to check (for example, "kakaotalk://", "mailto:", "https://...")
callbackJSFunctionCallback function that receives the result. Takes a single bool argument

Returns

void (the result arrives through callback)

Notes

  • The result is asynchronous. Use the callback pattern rather than await.
  • If the app isn't installed on the device, it returns false.
  • On Android, querying a specific URL scheme requires a <queries> entry in AndroidManifest.xml.
  • On iOS, the scheme must be listed in LSApplicationQueriesSchemes in Info.plist.
  • A URL parsing error or an exception always passes false.

Example

// Branch after checking whether KakaoTalk is installed
$app.canLaunchApp("kakaotalk://", function(ok) {
if (ok) {
$app.openUrl("kakaotalk://");
} else {
$vm.showToastMessage("error", "카카오톡이 설치되어 있지 않습니다.", 3000);
}
});

// Check the email app
$app.canLaunchApp("mailto:", function(ok) {
$log.i("이메일 앱 사용 가능:", ok);
});
  • $app.openUrl(urlScheme) — Launch an external app with a URL scheme
  • $app.openExternalBrowser(url) — Open a URL in an external browser