2016-07-08 00:32:33 +02:00
import { Cordova , Plugin } from './plugin' ;
2016-03-06 15:33:37 -05:00
/ * *
2016-03-13 15:45:07 -04:00
* @name App Availability
2016-03-12 18:30:16 -05:00
* @description
2016-03-06 15:39:09 -05: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.
*
2016-03-06 15:33:37 -05:00
* Requires Cordova plugin : cordova - plugin - appavailability . For more info , please see the [ AppAvailability plugin docs ] ( https : //github.com/ohh2ahh/AppAvailability).
*
* @usage
* ` ` ` js
2016-03-24 13:00:18 -04:00
* import { AppAvailability } from 'ionic-native' ;
*
*
2016-03-06 15:39:09 -05: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" )
* ) ;
2016-03-06 15:33:37 -05:00
* ` ` `
* /
@Plugin ( {
2016-03-12 18:30:16 -05:00
plugin : 'cordova-plugin-appavailability' ,
2016-03-12 19:08:47 -05:00
pluginRef : 'appAvailability' ,
2016-03-14 13:38:35 -04:00
repo : 'https://github.com/ohh2ahh/AppAvailability' ,
2016-04-29 23:56:49 -04:00
platforms : [ 'Android' , 'iOS' ]
2016-03-06 15:33:37 -05:00
} )
export class AppAvailability {
2016-03-06 15:35:59 -05:00
/ * *
* Checks if an app is available on device
2016-07-01 15:16:52 -04:00
* @param { string } app Package name on android , or URI scheme on iOS
2016-03-06 15:35:59 -05:00
* @returns { Promise < boolean > }
* /
@Cordova ( )
2016-04-29 23:56:49 -04:00
static check ( app : string ) : Promise < boolean > { return ; }
2016-03-06 15:35:59 -05:00
2016-03-06 15:33:37 -05:00
}