On Nov 25, 12:55 pm, David Given <[email protected]> wrote:

> Press HANGUP to turn screen off ->
>   onPause()
>   surfaceDestroyed()
>
> Press HANGUP again to screen on, going to the screen lock page ->
>   onResume()
>
> Deactivate screen lock, switch back to game ->
>   nothing!
>
> Not only am I not informed that my application has become visible again,

In doing a bit of testing, I'm seeing exactly the same thing in this
regard - my onResume handler gets called when the screen turns back
on, NOT when the lock screen goes away. That's completely at odds with
all other circumstances I've ever seen, where onPause gets called when
ANYTHING comes in front of my activity, and onResume doesn't get
called until my activity comes back to the top of the stack. It's like
the lock screen isn't on the usual activity stack.

And yeah, that's kind of rough for a highly interactive app like a
game. Most apps (including mine) will wait patiently until the user
interacts with them, so it's no problem that onResume gets called well
before the user can actually see the activity. But for a game, where
often the whole idea is that it's doing stuff on its own initiative,
that is a problem. What I've seen other games do (but never understood
until now) is to create your own "pause mode", activated in onPause,
and not deactivated until the user hits an on-screen "Resume" button.

> but I'm never informed that my surface has been created so I can start
> drawing on it again!

Now, that is different from what I'm seeing, although I don't have
exactly the same situation. My OpenGL app doesn't use a SurfaceHolder,
but instead subclasses GLSurfaceView.Renderer like this:

public class MyRenderer implements GLSurfaceView.Renderer {
    MyRenderer (Bitmap initMapImage, int initOrientation, Context
context) {
        // constructor code
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        // startup code
    }

    // more code
}

With this architecture, I do indeed get the onSurfaceCreated call when
the phone wakes up from sleep. Might you be able to rearchitect your
OpenGL code like this?

Interestingly, what I don't get with my approach is an
onSurfaceDestroyed when the phone is going into sleep. It's not a
problem for me, but it is something to be aware of.

String

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to