Android Question KeepAlive and PartialLock

mauro vicamini

Active Member
Licensed User
Longtime User
Hi Everyone,
maybe it's a stupid question: is it possible to use KeepAlive and PartialLock inside a service? Or is it possible to use them only in activities?

Thanks a lot
 

ilan

Expert
Licensed User
Longtime User
Keep alive will just prevent your phone from sleeping mode so it is ment for activities.
You can keep a service always in forground or use a sticky service if u dont want android to kill your service.

What exactly do you want to archive?
 
Upvote 0

mauro vicamini

Active Member
Licensed User
Longtime User
I'd like to keep alive a service in background of mobile phone that listen for request to send SMS. The problem is that the mobile goes after some time in stand by and don't recive the request to send SMS. Maybe is it better to use a PartialLock intsead of a keepalive?
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
You want to check if the phone is sending an sms with a service and when the phone send the sms u want to do something?
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0

mauro vicamini

Active Member
Licensed User
Longtime User
No, the service have a socket open to recive requests from a pc to send SMS. I'd like to prevent the mobile to go in stand by, so the service could continue to listen for requests to send SMS.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0
Top