android - Knowing if activity is running on foreground or background -
i use sounds notify user of events. however, not want app notify user sounds if activity not on foreground.
how can check if app running on background or not?
expanding on mco's answer, gcmintentservice needs trigger work in foreground activity of yours, if have foreground activity. typically, setting activities respond sort of message in onresume() , removing in onpause().
"some sort of message" be:
- an
intentsent vialocalbroadcastmanager - an
intentsent via classicsendbroadcast() - a message via message bus, otto
- etc.
Comments
Post a Comment