Ionic-framework: Platform.is('cordova') is not working properly.

Created on 21 Nov 2016  路  6Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[x ] 2.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
this.platform.is('cordova') returns false in Genymotion.

Expected behavior:
this.platform.is('cordova') should return true in Genymotion.

Steps to reproduce:

Just compile the code below and do 'livereload' in GenyMotion.

````

this.platform.ready().then( () => {
  if ( this.platform.is('cordova') ) console.log("Cordova");
  else console.log("NOT Cordova");
});

````

stale issue

Most helpful comment

A "quick" fix for the ones that want to work until a proper fix is done:

  1. clone this project
  2. replace the line here with
app.use('/', express.static(path.join(config.rootDir, 'platforms', '<platform>', 'platform_www')));

where <platform> changes to whatever you are working on at the moment (android, ios)

  1. at the cloned location of ionic-app-scripts run npm run build
  2. in your project remove dev dependency of "@ionic/app-scripts"
  3. in your project run npm install /path/to/ionic-app-scripts --save-dev
    5.1. if invalid remove node_modules folder and run npm install
  4. run with livereload

This is just a hardcoded hack so I am able to continue developing what I was doing until a fix is out. Maybe it helps someone.

All 6 comments

Out of curiosity, what is the command you use to run app in genymotion?

I'm seeing the same thing when I enable livereload (ionic run ios -l --device for example)

I found out it works on 'ionic run android'.
But it does not work on 'ionic run android -l'.

A "quick" fix for the ones that want to work until a proper fix is done:

  1. clone this project
  2. replace the line here with
app.use('/', express.static(path.join(config.rootDir, 'platforms', '<platform>', 'platform_www')));

where <platform> changes to whatever you are working on at the moment (android, ios)

  1. at the cloned location of ionic-app-scripts run npm run build
  2. in your project remove dev dependency of "@ionic/app-scripts"
  3. in your project run npm install /path/to/ionic-app-scripts --save-dev
    5.1. if invalid remove node_modules folder and run npm install
  4. run with livereload

This is just a hardcoded hack so I am able to continue developing what I was doing until a fix is out. Maybe it helps someone.

Is there a fix for this or we need to wait for RC5 or final version?

I am using RC4. When I run ionic run android everything works fun but it takes 16-18s to get device ready. If I run in production mode (ionic run android --prod) it says following although plugin is correctly installed:

Native: tried accessing the SQLite plugin but it's not installed.
Install the SQLite plugin: 'ionic plugin add cordova-sqlite-storage'
deviceready has not fired after 5 seconds.
Channel not fired: onFileSystemPathsReady
Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.

Thanks.

I get a long wait and deviceready has not fired after 5 seconds message with RC4 when built normally or with production flag. Reported messages:

main.js:28753 Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
2017-01-11 18:02:08.907 cordova.js:1185 deviceready has not fired after 5 seconds.
2017-01-11 18:02:08.908 main.js:28748 DEVICE READY FIRED AFTER 5323 ms

Functionality of all plugins seems to work so are unlikely the cause of this delay.

Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings