You can also manually set FLAG_KEEP_SCREEN_ON in the window.

On Tue, Jun 16, 2009 at 11:45 AM, Alexey Krasnoriadtsev <
[email protected]> wrote:

>
>
> http://developer.android.com/reference/android/view/View.html#attr_android:keepScreenOn
>
> This will keep the screen on, while your view is visible.
>
> On Jun 16, 3:52 am, Thomas Riley <[email protected]> wrote:
> > How would I go about doing this.
> >
> > I have the wake lock working ok now but no harm in knowing a different
> > method...
> >
> > On Jun 16, 8:49 am, Dianne Hackborn <[email protected]> wrote:
> >
> > > Do  you REALLY need to hold a full wake lock like this?  The vast
> majority
> > > of apps should use the window flag to keep the screen on while their UI
> is
> > > shown.  This way you don't need the power permission, and you are much
> less
> > > likely to have bugs that leave the screen on and cause the user's
> battery to
> > > drain.
> >
> > > On Sat, Jun 13, 2009 at 3:04 PM, Thomas Riley <
> [email protected]>wrote:
> >
> > > > I need to use a wakelock to hold the screen active while its
> required.
> > > > I was recommended to use a service which I have been trying but on
> the
> > > > onDestroy I am getting "wl cannot be resolved". Code below:
> >
> > > > public class WakeLockService extends Service {
> >
> > > >        @Override
> > > >        public IBinder onBind(Intent arg0) {
> > > >                // TODO Auto-generated method stub
> > > >                return null;
> > > >        }
> >
> > > >        public void onCreate() {
> > > >                PowerManager pm = (PowerManager) getSystemService
> > > > (Context.POWER_SERVICE);
> > > >                PowerManager.WakeLock wl = pm.newWakeLock
> > > > (PowerManager.FULL_WAKE_LOCK, "My Tag");
> > > >                wl.acquire();
> > > >        }
> >
> > > >        public void onDestroy() {
> > > >                wl.release();
> > > >        }
> >
> > > > }
> >
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > [email protected]
> >
> > > 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.
> >
> >
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

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 [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