I am building an android app using Unity and it is coming along very well. However, I'm having an odd issue relating to the screen timing out and the lockscreen not showing.
What Should Happen
- User stops playing
- Screen Times out and turns off
- Later, player returns and turns their phone back on
- Lockscreen shows, user can enter their password, or otherwise unlock their phone
- App regains focus and continues
What IS happening
- User stops playing
- Screen Times out and turns off
- Later, player returns and turns their phone back on
- Lockscreen does NOT show! The app is right in focus, bypassing the lockscreen all together
- Users get mad that their security is compromised :(
Notes
- This happens regardless of whether or not I'm using Android Plugins
- I'm using Unity 4.2.0f4 (Though the changelogs for the more recent versions have nothing about this issue)
- It even happens on a blank Android project
- I've tested this on 5 different devices, all have the same problem
I suspect that this is caused by a wakelock that Unity does not give up when the screen times out. This causes the app to hold focus and the lockscreen never gets to 'load'. This is a pretty serious problem.
Does anyone know of any way to fix this?
Note: I've already asked this question on Unity Answers a little over a week ago and haven't gotten any responses yet. I thought maybe I'd have better luck here.