I need to detect a visibility system (full screen) from a service. I tried to create a custom view and add setOnSystemUiVisibilityChangeListener , but it will never be called.
public void setListener() { setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int i) { Log.e(TAG, "onSystemUiVisibilityChange =" + i); } }); }
I am running setListener from my onStartCommand service. What is wrong here? Or is there any other method to detect when the ui system is visible or not? Thanks for any help.
source share