Getting a hidden status bar / entering a full-screen activity event in a service

I have a service that adds some views to the window manager (something like facebook chat heads). These looks remain at the top of everything all the time, even when I'm in the camera app. Can I find out when an activity (such as a camera or video player) uses the full screen so that I can hide my views?

Edit:

There is something called View.OnSystemUiVisibilityChangeListener, but it requires API 11. My goal is 9, but it looks like this is exactly what I need. Any alternative for API 9?

+4
source share
1 answer

Well, if someone is interested, I solved my problem as follows: Added a transparent view of the window manager with a width of 1px and a height of match_parent. Then a global layout receiver is added to this view, and every time there is a change in the layout, I check the position of this view on the screen. If Y is 0, the status bar is not visible, so a full-screen application should work. This works even better than the native View.OnSystemUiVisibilityChangeListener, because it seems that there are some applications that somehow do not start this method (for example, new weather in Yahoo).

+3
source

Source: https://habr.com/ru/post/1499748/


All Articles