I'm trying to create an application that would stay awake as long as the user chooses it to - and it would even stay awake in the case of an orientation change.
Initially I did this by creating a wake lock when the user decides that the application should stay awake, and then releasing this lock at onPause(), so that it is not held on to forever. but, when there is a change in orientation, the activity in question is destroyed and a new one is created - and I don't see a way to 'hand over' the wake lock to the new instance.
of course one could save it in the saved instance state - but at the time the activity is destroyed, one doesn't know if it's for the reason of an orientation change, or if it destroyed for good.
is there a generic way to achieve this?