我有一个信号让我的应用程序休眠指定的分钟数(使用 AlarmManager),然后将其唤醒。
一切正常,只是屏幕不亮。我正在使用 BroadcastReceiver 类中的唤醒锁:
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);
然后,当我确定我的应用程序已启动并运行并再次连接时,我会释放唤醒锁。但是,屏幕永远不会亮起!只有当我按下电源按钮手动唤醒屏幕时,该应用程序才会真正恢复活力。
我正在 HTC Hero 上进行开发。任何帮助将不胜感激..
您需要使用ACQUIRE_CAUSES_WAKEUP flag.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)