Ionic 2 Check App Availability: This plugin enables us to check whether the app is installed on User’s device or not. It requires a URI Scheme (e.g. twitter://) on iOS or a Package Name (e.g com.twitter.android) on Android. Here in this tutorial, we are going to explain how to check App Availability in the Ionic framework.
Ionic 2 Check App Availability Example
Cordova plugin cordova-plugin-appavailability is used to check the app availability. You can install it simply as below –
Ionic Check App Availability Example:
$ ionic plugin add cordova-plugin-appavailability $ npm install --save @ionic-native/app-availability |
Supported Platform
- Android
Example
Here is simple example of checking App availability –
Ionic 2 Check App Availability Example:
import { AppAvailability } from '@ionic-native/app-availability'; import { Platform } from 'ionic-angular'; constructor(private appAvailability: AppAvailability, private platform: Platform) { } ... let app; if (this.platform.is('ios')) { app = 'twitter://'; } else if (this.platform.is('android')) { app = 'com.twitter.android'; } this.appAvailability.check(app) .then( (yes: string) => console.log(app + ' is available'), (no: string) => console.log(app + ' is NOT available') ); |
Instance Members
- check(app): Checks if app is available on device.
Param | Type | Details |
---|---|---|
app | string | Package name on android, or URI scheme on iOS |
- Returns: It returns the promise.