@capawesome/capacitor-app-launcher 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +58 -2
  2. package/package.json +10 -3
package/README.md CHANGED
@@ -20,9 +20,14 @@ Capacitor plugin to check if an app can be opened and to open it.
20
20
 
21
21
  Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
22
22
 
23
- ## Newsletter
23
+ ## Use Cases
24
24
 
25
- Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
25
+ The App Launcher plugin is typically used to hand the user over to another app, for example:
26
+
27
+ - **App-to-app navigation**: Open a companion or partner app directly from your app via its URL scheme or package name.
28
+ - **Graceful fallbacks**: Check whether an app can be opened first and show an alternative if it is not installed.
29
+ - **Composing emails**: Open the user's mail app with a `mailto:` URL.
30
+ - **Launching Android apps by package name**: Open a specific app such as Gmail (`com.google.android.gm`) on Android.
26
31
 
27
32
  ## Compatibility
28
33
 
@@ -93,6 +98,12 @@ No configuration required for this plugin.
93
98
 
94
99
  ## Usage
95
100
 
101
+ The following examples show how to check whether an app can be opened and open another app.
102
+
103
+ ### Check if an app can be opened
104
+
105
+ Check whether an app can be opened before trying to open it. On iOS, the URL must be a URL scheme (e.g. `mailto:`); on Android, it can be a URL scheme or a package name (e.g. `com.google.android.gm`). Remember to declare every scheme and package name you check (see [Installation](#installation)), otherwise this method always resolves with `value: false`:
106
+
96
107
  ```typescript
97
108
  import { AppLauncher } from '@capawesome/capacitor-app-launcher';
98
109
 
@@ -100,6 +111,14 @@ const canOpenUrl = async () => {
100
111
  const { value } = await AppLauncher.canOpenUrl({ url: 'mailto:' });
101
112
  return value;
102
113
  };
114
+ ```
115
+
116
+ ### Open an app
117
+
118
+ Open another app with the given URL. On Android, the URL can also be a package name. The result tells you whether the app was opened successfully:
119
+
120
+ ```typescript
121
+ import { AppLauncher } from '@capawesome/capacitor-app-launcher';
103
122
 
104
123
  const openUrl = async () => {
105
124
  const { completed } = await AppLauncher.openUrl({ url: 'mailto:' });
@@ -209,6 +228,43 @@ This plugin is a drop-in replacement for the official `@capacitor/app-launcher`
209
228
 
210
229
  On Android, the `url` may be a URL scheme or a package name for both `canOpenUrl(...)` and `openUrl(...)`.
211
230
 
231
+ ## FAQ
232
+
233
+ ### How is this plugin different from other similar plugins?
234
+
235
+ It lets you both check whether an app can be opened and open it, and on Android the target can be a URL scheme or a package name, so you can launch a specific app like Gmail directly by its package. It uses only official platform APIs, keeping it safe for App Store and Google Play submissions, and pairs cleanly with the Maps Launcher and Settings Launcher plugins for a complete launching story. The API is fully typed, supports both CocoaPods and Swift Package Manager on iOS, and is actively maintained against the latest Capacitor and OS versions.
236
+
237
+ ### Why does `canOpenUrl` always return `false`?
238
+
239
+ This usually means the URL scheme or package name is not declared in your app. On Android 11 (API level 30) and above, every package name and URL scheme must be declared in the `<queries>` element of your `AndroidManifest.xml`. On iOS, every URL scheme must be declared in the `LSApplicationQueriesSchemes` key of your `Info.plist`. See the [Installation](#installation) section for examples.
240
+
241
+ ### Can I open an app by its package name?
242
+
243
+ Yes, but only on Android, where the `url` option accepts a URL scheme (e.g. `mailto:`) or a package name (e.g. `com.google.android.gm`). On iOS, only URL schemes are supported.
244
+
245
+ ### How can I check if an app is installed?
246
+
247
+ Use `canOpenUrl(...)` with the app's URL scheme or, on Android, its package name. Make sure the scheme or package name is declared as described in the [Installation](#installation) section. Note that on the Web, this method always resolves with `value: true` because the browser cannot determine whether a URL can be opened.
248
+
249
+ ### How is this plugin different from the official `@capacitor/app-launcher` plugin?
250
+
251
+ This plugin is a drop-in replacement with an identical API, so you only need to change the import and installation. In addition, on Android the `url` may also be a package name for both `canOpenUrl(...)` and `openUrl(...)`. See the [migration section](#migrating-from-capacitorapp-launcher) for details.
252
+
253
+ ### Can I use this plugin with Ionic, React, Vue or Angular?
254
+
255
+ Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
256
+
257
+ ## Related Plugins
258
+
259
+ - [Maps Launcher](https://capawesome.io/docs/sdks/capacitor/maps-launcher/): Launch navigation apps with turn-by-turn directions.
260
+ - [Settings Launcher](https://capawesome.io/docs/sdks/capacitor/settings-launcher/): Open native settings screens.
261
+ - [Android Intent Launcher](https://capawesome.io/docs/sdks/capacitor/android-intent-launcher/): Launch arbitrary Android intents.
262
+ - [Phone Dialer](https://capawesome.io/docs/sdks/capacitor/phone-dialer/): Open the native phone dialer prefilled with a phone number.
263
+
264
+ ## Newsletter
265
+
266
+ Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
267
+
212
268
  ## Changelog
213
269
 
214
270
  See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/app-launcher/CHANGELOG.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-app-launcher",
3
- "version": "0.0.1",
4
- "description": "Capacitor plugin to check if an app can be opened and to open it.",
3
+ "version": "0.1.0",
4
+ "description": "Capacitor plugin to check if an app can be opened and to open it on Android, iOS, and Web.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
@@ -39,7 +39,14 @@
39
39
  "plugin",
40
40
  "native",
41
41
  "app launcher",
42
- "deep link"
42
+ "deep link",
43
+ "capacitor-plugin",
44
+ "open app",
45
+ "launch app",
46
+ "url scheme",
47
+ "package name",
48
+ "open external app",
49
+ "can open url"
43
50
  ],
44
51
  "scripts": {
45
52
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",