EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using camera in my app lets the app sleep.

RedTint opened this issue · comments

Hi Team,

I'm not sure whether you guys also encountered this but using camera on my phone (inside the app) to upload an image freshly taken from cam makes the app sleep even when .keepAwake() is called.

Thanks!

Hey, the team here :)

I'm guessing the Android activity gets recreated after the camera was used. Interesting find.

Hi there,

This is actually from ios.

Ah, ok - this SO issue describes the problem perfectly; the Camera is likely kept awake by iOS and it sets your app to 'allowed to sleep' afterwards. This should be handled better by Apple, but it is what it is.

Since I can't (and won't) hijack the camera picker delegate and re-apply Insomnia you should manually do this in your app: once the camera callback gives control back to your app invoke the plugin again.

Thanks for reposting this quirk! I'm updating the README accordingly.

You're welcome. And thanks for solidifying my theory of what could be happening. :)