3

Neither one of the methods used to detect standalone mode in Chrome Android work in my PWA

This is the CSS method I tried

@media all and (display-mode: standalone) {
    /* Here goes the CSS rules that will only apply if app is running standalone */
}

And this is the Javascript method (line 171-175, 297-306)

function isRunningStandalone() {
    return (window.matchMedia('(display-mode: standalone)').matches);
}
...
if (isRunningStandalone()) {
    /* This code will be executed if app is running standalone */
}

Neither one of them worked: Testing isRunningStandalone() remotely in Chrome Android returns false, even though the example works.

(example made by @josemmo here)

I have tested the code in iOS and 3 different Android Phones. iOS works perfectly.

ganar
  • 627
  • 8
  • 17
  • Possibly related: https://bugs.chromium.org/p/chromium/issues/detail?id=850465 Can you reference the sample in the bug report as it appears to work correctly. – Morrison Chang Feb 12 '19 at 00:14

1 Answers1

5

I found the solution to the problem: manifest.json has to have "display": "standalone"

"display": "fullscreen" will not work. I could not test for it either.

ganar
  • 627
  • 8
  • 17