WakefulIntentService Xamarin.Android04 Sep 2016
I’ve seen this problem quite a lot recently…How do I receive notifications when my device is not awake? Is there a way to give an Android device coffee or have it listen to that Avicii song?(https://www.youtube.com/watch?v=IcrbM1l_BoI).
So you may ask: “What does
WakefulIntentService keeps a device awake by using the mechanism of
WakeLock is better known as a way to keep the device awake indefinitely until the
WakeLock is released somehow.
The good part about this code, is that it has been tested much further than a normal implementation of a
https://github.com/commonsguy/cwac-wakeful (Original Implementation in Java)
You could additionally use the Android Support package’s
WakefulBroadcastReceiver, which is a way to trigger work to be done by a broadcast. This however depends completely on the situation.
- Greater flexibility as it’s not strictly tied to an
- Uses one
WakeLockper request and therefore is more resilient for potential problems with a static
- Can be prone to a leak as the developer must call
- It is a time-limited
WakeLockand therefore will release after one minute. Which limits the flexibility with no overrides.
- If the process is terminated by anything which causes the service to restart, the restarted service will not be under a