cordova-plugin-inappbrowser icon indicating copy to clipboard operation
cordova-plugin-inappbrowser copied to clipboard

Screen always on for inappbrowser (option)

Open Hermarcel opened this issue 3 years ago • 5 comments

I have an app that displays a realtime monitoring page using inappbrowser. Because of its realtime character it's essential that the device screen/lcd stays on while displaying the page.

Using cordova-plugin-insomnia perfectly prevents the screen from switching off when the app is active, but it has no effect on the inappbrowser-window.

It would be nice to have a inappbrowser option to set this.

Hermarcel avatar May 17 '21 10:05 Hermarcel

I have made the changes myself, but am not familiair with Github. Which path do I go to have these changes merged into the plugin? I am not familiair with Github procedures so I would very much like to transfer my changes to someone who is.

I have added a new option which sets the FLAG_KEEP_SCREEN_ON flag. Very much like the current implementation of the fullscreen=yes/no option.

Hermarcel avatar May 24 '21 18:05 Hermarcel

@Hermarcel could you check if my changes match your idea?

ravicini avatar Sep 01 '21 08:09 ravicini

@Hermarcel could you check if my changes match your idea?

Your changes are 100% the same as mine :)

Hermarcel avatar Sep 01 '21 12:09 Hermarcel

Using cordova-plugin-insomnia perfectly prevents the screen from switching off when the app is active, but it has no effect on the inappbrowser-window.

Can you elaborate more on this? My initial thoughts were to leave this up to the community via a plugin, I was going to suggest that specific plugin as I use it in one of my apps as well. What prevents you from enabling the insomnia plugin just before you open the inappbrowser and listening for it's closure to disable insomnia? Does that not work?

breautek avatar Sep 03 '21 18:09 breautek

@breautek sorry for not responding that long.

The issue I observed is that when I disable the awake mode through:

dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

as the insomnia and other plugins do.

the dialog.getWindow() uses the main app window though. The in-app-browser opens another window and therefore the flag does not gets set on the proper window.

Do you have another idea, instead of implementing this in the in app browser plugin?

ravicini avatar Nov 23 '21 09:11 ravicini