-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not keep the screen awake on Android when accessed via chrome #7
Comments
@odkken thank you for bringing this up. Unfortunately, I don't have the experience in debugging mobile web apps from Chrome, so I might be hamstrung in trying to investigate this further. If you can provide an example app that reproduces this, that would also help. Lastly, I do take pull requests to resolve this issue. So if you have a lead on a possible fix, I'll be happy to review it. |
Sure, the provided example app is all I'm running. If you just launch it with
then access that from your phone's browser, you should be able to reproduce |
Huh, this seems to be an android-specific issue. I tried it on an iphone and it works fine. |
Here is a very simple working widget to provide the functionality: NOTE: the wakeLock object on the navigator is only available on https connections!
I will leave this here rather than submitting a pull request, as I am not familiar with flutter package development, and I think this would need to be added to the original wakelock package (the web implementation specifically). |
I can confirm there is some kind of issue with web, I tried on mobile both chrome and safari. nosleep.js testpage works fine. |
@diegotori any update on including/fixing this? I'd love to remove the hack, as it breaks cross-platform compatibility while js is included directly. |
It works in the latest Flutter version for me now. Thank you for making/maintaining the package! |
Hi @ocinon, Specifically I'm getting this error in the browser bonsole: |
@yannis216 I haven't tested it in a while and can't tell you which version it was. The two things that I did were update Flutter and call the enable function once the user presses a button on the page, as otherwise, it doesn't work (actually, it could be that I'm calling enable during each build call). |
Hosting the app locally, accessing it on an android device via chrome over LAN (e.g. 192.168.1.12:port)
The future returns the updated enabled/disabled value, but the screen still turns off.
If I go to the nosleep demo page on the same phone / browser (https://richtr.github.io/NoSleep.js/example) the screen stays on.
The text was updated successfully, but these errors were encountered: