ionic-framework: bug: platform#is('desktop') returning true on new Pixel 7 phones

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

On new pixel 7 phones, when the devices screen resolution is set to factory defaults (e.g. “highest” / “smallest” or “make everything as small as possible to show as much as possible” … max resolution), Ionic apps are reporting that the platform is ‘desktop’.

If screen resolution is dropped down by one notch, the platform is properly reported as ‘mobile’.

Not sure how best to report this, but this is what we’re seeing.

Expected Behavior

The platform should be reported as ‘mobile’, not ‘desktop’.

Steps to Reproduce

Run any ionic app on a Google Pixel 7 with default factory display settings. Platforms will contain ‘desktop’.

Code Reproduction URL

No response

Ionic Info

mshark:topdecked-unified lincoln$ ionic info

Ionic:

   Ionic CLI                     : 6.20.1 (/Users/lincoln/.nvm/versions/node/v16.14.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.3.4
   @angular-devkit/build-angular : 14.2.8
   @angular-devkit/schematics    : 14.2.8
   @angular/cli                  : 14.2.8
   @ionic/angular-toolkit        : 7.0.0

Capacitor:

   Capacitor CLI      : 4.4.0
   @capacitor/android : 4.4.0
   @capacitor/core    : 4.4.0
   @capacitor/ios     : 4.4.0

Utility:

   cordova-res : not installed globally
   native-run  : 1.7.1

System:

   NodeJS : v16.14.0 (/Users/lincoln/.nvm/versions/node/v16.14.0/bin/node)
   npm    : 8.3.1
   OS     : macOS Monterey

Additional Information

None. Not sure if this issue is related: https://github.com/ionic-team/ionic-framework/issues/24179

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Weird. Yeah looks like I pasted the wrong results for the P6. My pixel 6 shows the same as your 4a.

I confirm on the Pixel 7 pro my app is acting like Desktop => isDesktop is returned true.

Thanks for @vaibhav65577 for your temporary fix, I will try.

Any capacitor permanent update expected ?

For anyone who faces this issue, currently you can make temporary changes in app.module.ts and override methods which returns browser and mobile properties .

you can make changes in App.module file

    IonicModule.forRoot(
      {
      platform : {
        'desktop':(win)=>{
          return false
        },
        'mobile':(win)=>{
          return true
        }
      }
    })

I am also able to reproduce this using Pixel 7 through browserstack on https://hover-pointer-media-query.glitch.me:

Pixel 6 Pixel 7
Screen Shot 2022-11-11 at 4 32 01 PM Screen Shot 2022-11-11 at 4 30 53 PM