android - Why can't I find a reference to the StatusBarManager class directly? -


to dynamically drag down notification area in android, solution this

    object sbservice = getsystemservice( "statusbar" );     class<?> statusbarmanager = class.forname( "android.app.statusbarmanager" );     method showsb = statusbarmanager.getmethod( "expand" );     showsb.invoke( sbservice ); 

this works wonderfully, why nastiness reflection? why can't find reference statusbarmanager class directly? why there not constant in context class "statusbar" service?

why nastiness reflection?

because not part of android sdk. people interested in creating unreliable apps try interact statusbarmanager outside of android source code itself, since core android team , device manufacturers welcome change outside of sdk whenever wish.

why can't find reference statusbarmanager class directly?

because not part of android sdk. there great many classes , methods in android framework classes marked @hide annotation, sorts of reasons: unwillingness commit support api indefinitely, "security obscurity", etc.

why there not constant in context class "statusbar" service?

because not part of android sdk. welcome supply patches aosp have statusbarmanager "promoted" same status other system services (e.g., locationmanager, notificationmanager). if statusbarmanager situation merely oversight after sdk created in ~2007, patches might accepted , see change in upcoming version of android.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -