ionic-team / ionic-starter-super

The Ionic 2 Super Starter 🎮
Other
376 stars 142 forks source link

Check if source is cordova after platform.ready() #137

Closed simonhaenisch closed 7 years ago

simonhaenisch commented 7 years ago

related to #136

After platform.ready(), if I don't check that the source is cordova, some native modules (like OneSignal) throw errors in the browser that cordova is not available. Only tested that with ionic cordova run android so far, hope it's the correct way of doing it?

this.platform.ready().then(source => {
  if (source === 'cordova') {
    // now platform is ready and cordova is available => native modules can be used
    this.statusBar.styleDefault();
    this.splashScreen.hide();
  }
});
janpio commented 7 years ago

My guess (and feeling): These errors are pretty much intended behaviour to make it clear that Ionic Native functionality is not available in the browser.

danielsogl commented 7 years ago

@simonhaenisch I close this issue because it has nothing to do with the super-starter project itself. All Ionic Native plugins without browser support throw this warning.

simonhaenisch commented 7 years ago

Why does it not have anything to do with the super-starter? Isn't this supposed to be a best practices starting point? And isn't that the way to handle native plugins without browser support?