Well you could register for this: http://developer.android.com/reference/android/content/Intent.html#ACTION_SCREEN_OFF
On Fri, Nov 27, 2009 at 3:47 AM, David Given <d...@cowlark.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is there any way where I can detect that the screen is about to turn > off, so I can do some work *before* it happens? > > I need this to work around bug 3755: OpenGL apps sometimes crash when > the screen gets turned off because they don't get > surfaceDestroyed()/surfaceCreated() events. > > http://code.google.com/p/android/issues/detail?id=3755 > > Simply put, I need to shut down OpenGL before the phone has a chance to > detach the GPU. The only events I seems to be getting when the screen > turns off are onPause() and onWindowFocusChanged()... both of which turn > up *after* the GPU detaches, by which time it's too late. > > Can anyone suggest any way of doing this? > > (In desperation, I have tried to intercept the power key, but the > power/hangup key is treated specially and doesn't generate keyboard > events...) > > - -- > ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── > │ > │ "Sufficiently advanced incompetence is indistinguishable from > │ malice." -- Vernon Schryver > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAksPvFIACgkQf9E0noFvlzioGACfW5r72xNXqykHvSu4SocKo0bw > rlkAoLNa6NZiWgczIBHtLmgJmzFZLiaR > =HOwY > -----END PGP SIGNATURE----- > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en