I think that you may be missing the needed permissions. Make sure that you have the EXPAND_STATUS_BAR permission in your Manifest.xml:
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
Looking around, I found this code:
Object sbservice = getSystemService( "statusbar" );
Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" );
Method showsb = statusbarManager.getMethod( "expand" );
showsb.invoke( sbservice );
You may want to try it.
EDIT:
For actually detecting if it is down or not, see this answer. Here's what it looks like:
Override the onWindowFocusChanged() method in your activity with the code below:
In the permissions:
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
The overriding:
@Override
public void onWindowFocusChanged(boolean hasFocus)
{
try
{
if(!hasFocus)
{
Object service = getSystemService("statusbar");
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
Method collapse = statusbarManager.getMethod("collapse");
collapse .setAccessible(true);
collapse .invoke(service);
}
}
catch(Exception ex)
{
if(!hasFocus)
{
try {
Object service = getSystemService("statusbar");
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
Method collapse = statusbarManager.getMethod("collapse");
collapse .setAccessible(true);
collapse .invoke(service);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ex.printStackTrace();
}
}
}