How to tell if notification shade is pulled down in android

前端 未结 1 1966
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 22:27

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(         


        
相关标签:
1条回答
  • 2020-12-19 22:35

    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.

    0 讨论(0)
提交回复
热议问题