Home > Blockchain >  Is it possible to prevent an Android WebApplication from turning the screen
Is it possible to prevent an Android WebApplication from turning the screen

Time:11-11

I've got an asp.net Application that uses an manifest.json to be "installed" localy on android devices.

In this manifest I've added: "display":"standalone and "orientation": "landscape"

But it is still rotating 180° if I flip the phone upside down, even if "Screen rotation" is turned off on all these decises. The Problem is, that Those devices have a scanner on top that is used to scann barcodes. So if you flip the phone upside down to scan something the whole webpage turns around and you can't read it anymore when you flip it back up. you eighter have to hold is straight up again, or "shake" it a bit to get it flipping back again.

Edit 20211110: It's a Website, that is running on our local IIS. The Web-page uses a MANIFEST.JSON so that chrome, Firefox and safari promt the user to "install" the Website. This creates a Shortcut on the Main Launcher that opens the website like an Android App. (It's like Twitter, when you brose their website on your andorid Phone it promts you to install the app, but in reality it only creates a shotcut to the website)

{
  "short_name": "Short",
  "name": "AppName",
  "icons": [
    {
      "src": "Images/icon192.png",
      "sizes": "192x192",
      "type": "image/png",
      "purpose": "any maskable"
    },
    {
      "src": "Images/icon512.png",
      "sizes": "512x512",
      "type": "image/png",
      "purpose": "any maskable"
    }
  ],
  "start_url": "./Login.aspx",
  "display": "standalone", /* Could be "fullscreen", "standalone", "minimal-ui", or "browser" */
  "orientation": "portrait", /* Could be "landscape" or "portrait" */
  "background_color": "#DE007E", /*"#DE007E"*/
  "theme_color": "#DE007E" /*"#DE007E"*/
}

CodePudding user response:

Okay, I figured it out now. The option "orientation": "portrait" caused the PWA to be ALWAYS in Portrait, even if the Device is held upside down. So I just had to remove this option from the manifest.json and now it works.

  • Related