Wakelock不打开屏幕上?帮帮我? [英] Wakelock is not turning on the screen? Help?

查看:174
本文介绍了Wakelock不打开屏幕上?帮帮我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有把我的应用程序睡分钟(使用AlarmManager)给定数量的信号,然后唤醒它回来了。

I have a signal that puts my app to sleep for a given number of minutes (using AlarmManager) and then wakes it back up.

一切工作,除了屏幕没有以往任何时候都来吧。我使用wakelock像这样从一个BroadcastReceiver类:

Everything is working except the screen doesn't ever come on. I'm using a wakelock like so from a BroadcastReceiver class:

     KeyguardManager key = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
     KeyguardLock lock = key.newKeyguardLock(TAG);
     lock.disableKeyguard();
     Log.v(TAG, "alarm: disabled keyguard.");

     PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
     gpsMain.wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG);
     gpsMain.wl.acquire();
     Log.v(TAG, "alarm: acquired wakelock");

     Intent i = new Intent();
     i.setAction(CUSTOM_INTENT);
     context.sendBroadcast(i);

我再放开wakelock时,我敢肯定,我的应用程序已经启动并运行,然后重新连接。但是,屏幕永远不会到来了!该应用程序实际上只回来生活,当我按下电源按钮手动唤醒屏幕。

I then release the wakelock when I'm sure that my app is up and running and connected again. However, the screen never comes on! The app only actually comes back to life when I hit the power button to wake up the screen manually.

我开发上HTC Hero的。任何援助将不胜AP preciated ..

I'm developing on an HTC Hero. Any assistance would be GREATLY appreciated..

推荐答案

您需要使用的 ACQUIRE_CAUSES_WAKEUP 标志。

You need to use the ACQUIRE_CAUSES_WAKEUP flag.

这篇关于Wakelock不打开屏幕上?帮帮我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆