kev liu
kev liu

Reputation: 21

Can android foreground services listen for key presses?

I am trying to write a service that can listen for volume key presses but I have read somewhere that services are not supposed to react to user actions. Does that apply to foreground services as well??

Thanks!

Upvotes: 0

Views: 548

Answers (1)

user658042
user658042

Reputation:

Foreground services are normal services, the only difference is that those are less-likely/not killed when the system is low on memory, because the user is actively aware of them (e.g. downloading a file with a progress indicator as a notification). It's only a higher priority memory wise if you will.

So yes, that applies to those as well.

Upvotes: 1

Related Questions