What does "PowerManger.FULL_WAKE_LOCK is deprecated" mean?

silvia_aut picture silvia_aut · Sep 24, 2013 · Viewed 12.6k times · Source

I have this code:

wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
            | PowerManager.ON_AFTER_RELEASE, "MyWakeLock");

And the FULL_WAKE_LOCK is crossed out and it's saying "PowerManger.FULL_WAKE_LOCK is deprecated". The code is working. But what does it mean exactly? And can it evoke any problems?

Answer

ashatte picture ashatte · Sep 24, 2013

Deprecation means that the feature may be removed in future versions of Android, or that an alternative has been added. It's not removed immediately to ensure backwards compatibility and to give you time to comply with the new standard.

Which is, according to the documentation:

"Most applications should use FLAG_KEEP_SCREEN_ON instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission."

So it won't cause any problems now, but in future versions of Android, it may. You can read more about deprecation here.