本文整理汇总了TypeScript中ionic-native.AppAvailability.check方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AppAvailability.check方法的具体用法?TypeScript AppAvailability.check怎么用?TypeScript AppAvailability.check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ionic-native.AppAvailability
的用法示例。
在下文中一共展示了AppAvailability.check方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: checkTwitter
checkTwitter() {
AppAvailability.check(this.app)
.then(
yes => this.isAvailable = 'Twitter is Installed',
no => this.isAvailable = 'Twitter is not Installed'
);
}
示例2: openFacebook
/**
* opens the url with the system app if installed or in the browser
* @param url url of the website
*/
openFacebook(url) {
let app;
if (this.platform.is('ios')) {
app = 'fb://';
}
else if (this.platform.is('android')) {
app = 'com.facebook.katana';
}
AppAvailability.check(app).then(
function () { // Success callback
open('fb://page/' + url, '_system', 'location=no');
console.log('Facebook is available');
},
function () { // Error callback
open('https://www.facebook.com/' + url, '_system', 'location=no');
console.log('Facebook is not available');
});
}
示例3: openYouTube
/**
* opens the url with the system app if installed or in the browser
* @param url url of the website
*/
openYouTube(url) {
let app;
if (this.platform.is('ios')) {
app = 'youtube://';
}
else if (this.platform.is('android')) {
app = 'com.google.android.youtube';
}
AppAvailability.check(app).then(
function () { // Success callback
open(url, '_system', 'location=no');
console.log('YouTube is available');
},
function () { // Error callback
open(url, '_system', 'location=no');
console.log('YouTube is not available');
});
}
示例4: openTwitter
/**
* opens the url with the system app if installed or in the browser
* @param url url of the website
*/
openTwitter(url) {
let app;
if (this.platform.is('ios')) {
app = 'twitter://';
}
else if (this.platform.is('android')) {
app = 'com.twitter.android';
}
AppAvailability.check(app).then(
function () { // Success callback
open(url, '_system', 'location=no');
console.log('Twitter is available');
},
function () { // Error callback
open(url, '_system', 'location=no');
console.log('Twitter is not available');
});
}