cordova-plugin-inappbrowser
cordova-plugin-inappbrowser copied to clipboard
Screen always on for inappbrowser (option)
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.
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 could you check if my changes match your idea?
@Hermarcel could you check if my changes match your idea?
Your changes are 100% the same as mine :)
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 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?