Tuesday, 10 September 2013

How can you tell if an android service is running in the foreground from code?

How can you tell if an android service is running in the foreground from
code?

From within a particular service I want to know if I'm already in the
foreground. I looked at:
ActivityManager.RunningServiceInfo
specifically RunningServiceInfo.foreground, but the documentation says,
"Set to true if the service has asked to run as a foreground process."
So can I rely on RunningServiceInfo.foreground? Or should I go about this
another way?

No comments:

Post a Comment