ionic-team / ionic-starter-super

The Ionic 2 Super Starter 🎮

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check if source is cordova after platform.ready()

simonhaenisch opened this issue · comments

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();
  }
});

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.

@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.

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?