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?
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.
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?
If yes than you dont need to have a service in forground or a sticky service you can listen to sms_receive or send intent and like this perform what ever u want when the phone send/receive a sms.
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.
if the mobile goes to standby the service should still work only if you kill the app or android does then the service will be killed to.
but you can use a sticky service to keep it alive or use "Service.StartForeground"