本文整理匯總了TypeScript中ionic-native.AppAvailability類的典型用法代碼示例。如果您正苦於以下問題:TypeScript AppAvailability類的具體用法?TypeScript AppAvailability怎麽用?TypeScript AppAvailability使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了AppAvailability類的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');
});
}