I have a program that creates a notification if the application is not running. To do this, I have used the following code:
public void onWindowFocusChanged(
I don't believe there is a way, but I could be wrong. However, I think detecting when the notification shade is down is the wrong way to go about what you want.
You should probably track if you're activity is the active one via Activity#onResume
and Activity#onPause
. Say, if onResume
is called set a flag somewhere and when onPause
is called reset it. If the flag is set you're activity is open so don't send the notification.