My application allows launching of another application from mine. None of my activity shows Status Bar. But when launching other applications like Camera the user can access the status bar. So I tried the following code snippet for collapsing the Status Bar inside a service (so it collapses every time and the code is always running).
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
Object service = getSystemService("statusbar");
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
Method collapse = null;
if(currentapiVersion <= 16){
collapse = statusbarManager.getMethod("collapse");
}else{
collapse = statusbarManager.getMethod("collapsePanels");
}
collapse.setAccessible(true);
collapse.invoke(service);
Now I want to collapse the status bar only if the user tries to expand this? Is there any intent or intent filter that exists for detect expanding of the Status bar?