Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getLaunchUrl() {
const ret = await Plugins.App.getLaunchUrl();
if(ret && ret.url) {
alert('App opened with URL: ' + ret.url);
}
console.log('Launch url: ', ret);
}
async canOpenUrl() {
const ret = await Plugins.App.canOpenUrl({ url: 'com.getcapacitor.myapp' });
console.log('Can open url: ', ret.value);
}
constructor(platform: Platform) {
Plugins.SplashScreen.hide();
/*
Plugins.App.addListener('pluginError', (err: any, info: any) => {
console.error('There was a serious error with a plugin', err, info);
});
*/
Plugins.App.addListener('appStateChange', (state: any) => {
console.log('App state changed', state);
});
Plugins.App.addListener('appUrlOpen', (data: any) => {
alert('APP URL OPEN: ' + data.url);
});
Plugins.App.addListener('appRestoredResult', (data: any) => {
alert('Got restored result');
console.log('Restored result:', data);
});
this.getLaunchUrl();
}
Plugins.SplashScreen.hide();
/*
Plugins.App.addListener('pluginError', (err: any, info: any) => {
console.error('There was a serious error with a plugin', err, info);
});
*/
Plugins.App.addListener('appStateChange', (state: any) => {
console.log('App state changed', state);
});
Plugins.App.addListener('appUrlOpen', (data: any) => {
alert('APP URL OPEN: ' + data.url);
});
Plugins.App.addListener('appRestoredResult', (data: any) => {
alert('Got restored result');
console.log('Restored result:', data);
});
this.getLaunchUrl();
}