When to acquire wakelock for an intent service?
Asked Answered
P

1

0

I am trying to understand the use of partial wake locks in android. I have a wakeful intent service which starts another intent service.

If I don't acquire a wakelock for the called intent service, the intents will be processed when the CPU wakes up? Is there any scenario where these intents are not processed at all?

Payne answered 27/6, 2015 at 6:54 Comment(1)
I'd say yes although I can't find any docs - how do you start the service ?Rhigolene
S
0

If you call startService() [whether directly or by calling send() on a service PendingIntent], it starts up the OS's process of spinning up that service. The device going to sleep in the middle won't interrupt that process; it will just delay it until the device is awake and running long enough to finish the process of starting up the service you requested.

The only time the service will never start is if there is something wrong with the startService() request itself -- the Intent does not resolve to a real Service definition, or you don't have permission to start that service, or something like that. None of these failure modes have anything to do with wakelocks, though. The wakelock situation won't cause startService() to fail outright.

Sokul answered 1/7, 2015 at 18:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.