I need a way to determine if an activity is active or in the background. I have a service that notifies the user, but I want to do this only when activity is inactive. I can use global variables, for example, set them in onStop (), but is there any other way?
source
share