awesome-cordova-plugins/src/plugins/appavailability.ts

47 lines
1.2 KiB
TypeScript
Raw Normal View History

import {Plugin, Cordova} from './plugin';
/**
2016-03-14 03:45:07 +08:00
* @name App Availability
* @description
2016-03-07 04:39:09 +08:00
* This plugin allows you to check if an app is installed on the user's device. It requires an URI Scheme (e.g. twitter://) on iOS or a Package Name (e.g com.twitter.android) on Android.
*
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
*
* @usage
* ```js
* import {AppAvailability} from 'ionic-native';
*
*
2016-03-07 04:39:09 +08:00
* var app;
*
* if(device.platform === 'iOS') {
* app = 'twitter://';
* }else if(device.platform === 'Android'){
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* .then(
* yes => console.log(app + " is available"),
* no => console.log(app + " is NOT available")
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-appavailability',
2016-03-13 08:08:47 +08:00
pluginRef: 'appAvailability',
2016-03-15 01:38:35 +08:00
repo: 'https://github.com/ohh2ahh/AppAvailability',
platforms: ['Android','iOS']
})
export class AppAvailability {
/**
* Checks if an app is available on device
* @param app Package name on android, or URI scheme on iOS
* @returns {Promise<boolean>}
*/
@Cordova()
static check(app: string): Promise<boolean> { return }
}