Issue
Usually, Android calls onPause
on your Activity
when it starts being obscured or hidden, followed by onStop
when it's no longer shown at all. In my game, I pause the game in onPause
, so the user doesn't lose the game while looking elsewhere.
However, when the user drags down the notification bar, it covers my Activity
, but neither onPause
nor onStop
are called. This doesn't seem to be mentioned in the documentation. The game ticks away in the background with nobody looking at it. Is there some other way to tell my Activity
has been obscured when this happens, so I can pause the game before the user loses? I can't find anything at all about this on the Android Developers site.
Solution
Since the StatusBarManager isn't part of the official API, I find it unlikely that there is a way to detect it. Even using reflection, none of the statusbar-classes seem to have a hook for listeners.
If it is feasible, you could deactivate the statusbar. Otherwise, I think you are out of luck :(
Answered By - pgsandstrom
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.