Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open or expand status bar through intent?

I am making a home application and I think that it will be suitable if I use a fullscreen and not show the status bar. So now I want to be able to open or expand the status bar with a button on the menu, similar to the way some default home applications have in the menu. I know its possible since the default home does it. Is this done through an intent? If so can I have the code for it. If not well then I would appreciate it if you guys showed me how. Thanks!

like image 590
user861040 Avatar asked Dec 17 '22 10:12

user861040


1 Answers

See if this helps and let me know...

 try{

   Object service  = getSystemService("statusbar");
  Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
  Method expand = statusbarManager.getMethod("expand");
  expand.invoke(service);

}
catch(Exception ex){
 ....
}

uses permission : "android.permission.EXPAND_STATUS_BAR";
like image 136
Umesh Avatar answered Jan 08 '23 18:01

Umesh