ionic 5 open another application
import { Component } from '@angular/core';
import { AppLauncher, AppLauncherOptions } from '@ionic-native/app-launcher/ngx';
import { Platform } from '@ionic/angular';
@Component({
selector: 'app-tab3',
templateUrl: 'tab3.page.html',
styleUrls: ['tab3.page.scss']
})
export class Tab3Page {
constructor(private appLauncher: AppLauncher,
private platform: Platform) { }
open() {
const options: AppLauncherOptions = {
packageName:"com.instagram.android"
}
// if(this.platform.is('ios')) {
// options.uri = 'fb://'
// } else {
// options.packageName = 'com.instagram.android'
// }
this.appLauncher.canLaunch(options)
.then((canLaunch: boolean) => {
if (canLaunch) {
this.appLauncher.launch(options).then(() => {
},(err)=> {
alert(JSON.parse(err));
})
} else {
alert("Unable to lunch application.")
}
},(err)=> {
alert(JSON.parse(err));
});
}
open1() {
}
}
Comments
Post a Comment