I need to turn screen ON, then push message arrived, so i start intentService from WakefulBroadcastReceiver, and in service create notification, then turn screen on by this code:
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
if(!pm.isScreenOn())
{
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE
, "MyLock");
wl.acquire(5000);
}
this works well
However, PowerManager.FULL_WAKE_LOCK is deprecated now, and i don't see way how to use LayoutParams.FLAG_KEEP_SCREEN_ON in service, as documentation suggests.
Any alternatives to FULL_WAKE_LOCK ?? How to avoid using deprecated api?
0 comments:
Post a Comment