Search code examples
androidgoogle-cloud-messagingwakelock

Android: Do I need a WakeLock for a really short task?


I have a BroadcastReceiver that is called when a GCM message arrives.
All it does is that it sets an "update on next app start"-flag in the shared preferences, and pushes a notification.
So far, I haven't encountered a problem without a WakeLock, and I would like to keep app permissons as few as possible.
Is it likely, that the device will go back to sleep during this millisecond process?


Solution

  • If that's all your doing, then you don't need a WakeLock. If you were doing a bigger task that took more time then you should use a service, if it's only a few seconds (less in your case) you can go without it.