# Ionic 4 this.platform.is returning wrong value

**URL:** <https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890>\
**Category:** Ionic Framework\
**Created:** [July 31, 2018, 5:05pm UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890 "2018-07-31T17:05:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterwb](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@peterwb](https://forum.ionicframework.com/u/peterwb)\
**Post date:** [July 31, 2018, 5:05pm UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/1 "2018-07-31T17:05:22Z")

</div>

Started a new Ionic 4 sidemenu app and added Platform. Code below, on Safari and Chrome it returns Android for Platform and Versions. Any suggestions?? BTW, when running in iOS simulator the correct values are returned.

```auto
import { Component } from '@angular/core';
import { Platform } from "@ionic/angular";
import { Device } from '@ionic-native/device/ngx';

@Component({
  selector: 'app-page-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  myDevice: string;
  myHeight: any;
  myWidth: any;
  myPlatforms: any;
  myVersions: any;
  constructor(public platform: Platform, private device: Device)
  {

    platform.ready().then(() => {
      this.onDeviceReady();
    });
  }

  onDeviceReady() {

    if(this.platform.is('ios')){
      this.myDevice = 'ios';
    }
    if(this.platform.is('android')){
      this.myDevice = 'android';
    }
    if(this.platform.is('mobileweb')){
      this.myDevice = 'web';
    }
    if(this.platform.is('core')){
      this.myDevice = 'web';
    }
    this.myHeight = this.platform.height();
    this.myWidth = this.platform.width();
    this.myPlatforms = this.platform.platforms();
    this.myVersions = JSON.stringify(this.platform.versions());
    console.log('Device UUID is: ' + this.device.uuid);
    console.log('Device platform is: ' + this.device.platform);
    console.log('Device verision is: ' + this.device.version);

  }
}

```

Results:  
 ![46%20AM](https://global.discourse-cdn.com/ionicframework/original/3X/4/e/4efc32ccad64437d89bc624ebddbeeb90b516165.png)

My Ionic Info:

```auto
Ionic:

   ionic (Ionic CLI) : 4.0.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework : @ionic/angular 4.0.0-beta.0
   @angular-devkit/core : 0.7.0-rc.3
   @angular-devkit/schematics : 0.7.0-rc.3
   @angular/cli : 6.0.8
   @ionic/ng-toolkit : 1.0.0
   @ionic/schematics-angular : 1.0.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms : ios 4.5.5

System:

   ios-deploy : 1.9.2
   ios-sim : 5.0.13
   NodeJS : v9.5.0 (/usr/local/bin/node)
   npm : 6.2.0
   OS : macOS High Sierra
   Xcode : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : not set

```

---

<div class="post-metadata">

**Author:** ![763a0bc7](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/763a0bc7/32/114473_2.png) [@763a0bc7](https://forum.ionicframework.com/u/763a0bc7)\
**Post date:** [July 31, 2018, 6:43pm UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/2 "2018-07-31T18:43:42Z")

</div>

I’ve already posted this bug on [Github](https://github.com/ionic-team/ionic/issues/14802). They’ve also messed the android platform detection.

---

<div class="post-metadata">

**Author:** ![anandacharya](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anandacharya](https://forum.ionicframework.com/u/anandacharya)\
**Post date:** [January 2, 2019, 9:40am UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/3 "2019-01-02T09:40:14Z")

</div>

onic-4 Platform specific value

goto- node\_modules@ionic\angular\dist\providers\platform.d.ts

Platform Name | Description |

```auto
 * | android | on a device running Android. |
 * | cordova | on a device running Cordova. |
 * | ios | on a device running iOS. |
 * | ipad | on an iPad device. |
 * | iphone | on an iPhone device. |
 * | phablet | on a phablet device. |
 * | tablet | on a tablet device. |
 * | electron | in Electron on a desktop device. |
 * | pwa | as a PWA app. |
 * | mobile | on a mobile device. |
 * | desktop | on a desktop device. |
 * | hybrid | is a cordova or capacitor app. |

```

---

<div class="post-metadata">

**Author:** ![jacky-gds](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jacky-gds/32/131930_2.png) [@jacky-gds](https://forum.ionicframework.com/u/jacky-gds)\
**Post date:** [July 2, 2019, 12:20pm UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/4 "2019-07-02T12:20:03Z")

</div>

Yes, same issue here, after run once

`ionic serve --devapp`

quitted the serve process, and then launched:

`ionic serve`

served

`(3) ["android", "mobile", "mobileweb"]`

in broswer.

* * *

Moreover, all github related issues are now closed without solutions, patch or upgrades.

> <https://github.com/ionic-team/ionic/issues/15165>

  

> <https://github.com/ionic-team/ionic/issues/14802>

Now trying to upgrade ionic from 5.0 to 5.2 latest and see it would help.

---

<div class="post-metadata">

**Author:** ![edthenet](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/edthenet/32/81379_2.png) [@edthenet](https://forum.ionicframework.com/u/edthenet)\
**Post date:** [October 10, 2019, 11:46am UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/5 "2019-10-10T11:46:49Z")

</div>

I’m now using ionic 5.4.3 and it still not working

I use Ghrome with the developer toolbar to test my mobile view, but platform “core” is still not available

---

<div class="post-metadata">

**Author:** ![timsar](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@timsar](https://forum.ionicframework.com/u/timsar)\
**Post date:** [January 18, 2021, 4:37pm UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/6 "2021-01-18T16:37:21Z")

</div>

If you Enabled **Toggle device toolbar** from browser, It’ll return mobile. and if it is disabled then return desktop.  
be sure to refresh the page(f5) after changing the state of that.

 ![](https://global.discourse-cdn.com/ionicframework/original/3X/1/4/142598d481de2b7a1334a9c893e8a4e3d23afa3f.png)

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 8:52pm UTC](https://forum.ionicframework.com/t/ionic-4-this-platform-is-returning-wrong-value/136890/7 "2021-07-19T20:52:18Z")

</div>

Closed on July 19, 2021, 8:52pm UTC


