creativecreatorormaybenot/wakelock

Can't disable wake lock on iOS

EinatK opened this issue · 4 comments

Works fine on android, but on iOS both Wakelock.disable() and Wakelock.toggle(enable: false) are called without any error, but screen stays on forever.
No error or exception thrown, The code was called, but nothing happened..
As soon as I let the app the screen dimmed as expected.
Tested on real device, iPhone 11, iOS 15.4.1

Super simple code: (Tried with and without awaiting, no change)

ElevatedButton( onPressed: () async { try { if (await Wakelock.enabled) { // await Wakelock.enable(); await Wakelock.toggle(enable: false); } else { // await Wakelock.disable(); await Wakelock.toggle(enable: true); } } catch (error) { print(error); } },

i am having the same problem. On Android, wakelock.enable() works flawlessly. But it doesn't work in apple even if I set wakelock.disable(). It is observed that the await wakelock.enabled value turns false.

Have you solved this problem now?

The problem is still present tested on ios 16.6.1

I will soon discontinue this repository. Please use wakelock_plus: ^1.1.6 instead.