2

Possible Duplicate:
How can I programmatically open/close notifications in Android?

I need a code that will drop down the status bar in android programmatically. Is there any way to drop it down ?

Community
  • 1
  • 1
KhalidTaha
  • 453
  • 1
  • 5
  • 11
  • 1
    You can start by searching SO... http://stackoverflow.com/questions/5029354/how-can-i-programmatically-open-close-notifications-in-android – Booger Jan 14 '13 at 14:35

1 Answers1

8

Use this code anywhere.

Object sbservice = getSystemService( "statusbar" );
Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" );
Method expandMethod;
        if (Build.VERSION.SDK_INT >= 17) {
            expandMethod = statusBarManager.getMethod("expandNotificationsPanel");
        } else {
            expandMethod = statusBarManager.getMethod("expand");
        }
expandMethod .invoke( sbservice );

Or to make it more short use this :

StatusBarManager statusBar = (StatusBarManager) getSystemService(STATUS_BAR_SERVICE);
statusBar.expand();

Permission is required in manifest.

<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
Community
  • 1
  • 1
Hisham Muneer
  • 8,558
  • 10
  • 54
  • 79