Skip to content
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

Device Screen still turns Off #59

Open
zionnite opened this issue May 12, 2024 · 7 comments
Open

Device Screen still turns Off #59

zionnite opened this issue May 12, 2024 · 7 comments

Comments

@zionnite
Copy link

zionnite commented May 12, 2024

Hello Creator,

I started using your package today and I'm grateful for the amount of work you put into this,
however, I'm not getting the desired result with this package.
I'm creating a Streaming App where users stream to thousands of followers but it seems WakelockPlus.enable() is not working because the device screen still turns off instead of the device's screen being on all through till the user exists the page and the dispose function () which has the WakelockPlus.disable() it's in

current package of interest
wakelock_plus: ^1.2.5
win32: ^5.5.0

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale
    en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] IntelliJ IDEA Community Edition (version 2023.3.2)
[✓] VS Code (version 1.89.0)
[✓] Connected device (4 available)
[✓] Network resources

Please, what I'm I doing wrong?

@zionnite
Copy link
Author

@diegotori , please what do you think of this?

@diegotori
Copy link
Collaborator

What platform are you using?

Also, iOS has known issues where it may not keep the screen on (affecting 16.4 and higher). Once I get myself an iOS device, I'm gonna port the code from Insomnia.swift into the iOS platform channel. The emulator may not be ideal for testing the wakelock.

Nevertheless, I do accept and will review PRs related to this. As long as it passes the existing integration tests, then it'll get merged and released.

If you submit a PR to this effect, then you will also have to update wakelock_plus_platform_interface and regenerate the pigeon classes so that they generate Swift instead of Objective-C.

@zionnite
Copy link
Author

I'm testing on Android at the moment

@zionnite
Copy link
Author

Please, what are the possible things i need to do now to prevent the device screen from sleeping?, my app is already in Production, I need to fix it fast as possible

@diegotori
Copy link
Collaborator

diegotori commented May 12, 2024

Please, what are the possible things i need to do now to prevent the device screen from sleeping?, my app is already in Production, I need to fix it fast as possible

I need to know which device in particular is causing this issue, which version of Android, etc...

Also, try running the project's example app as an initial sanity check. If that app works without issue, then it might be the way your app is being configured, or even the device itself.

@diegotori
Copy link
Collaborator

Furthermore, after doing a quick Google search, it seems that this is a known issue, where WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, which is what this library adds and removes in its Android platform channel, doesn't end up working.

What's even worse is that when these issues pop up, the poster never specified the device and Android version that it failed to keep the screen on.

Long story short, the Android platform channel is doing this by the book: using WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON with the current activity that is running Flutter.

@zionnite
Copy link
Author

@diegotori , it is working now...
I guess clearing the caches by flutter pub cache clean and flutter clean did the trick
Thanks for your support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants