Device Owner - Get back status bar icons in lock task mode

NovakNovak CHMember ✭✭✭

I have developed device owner application that have some kiosk admin app capabilities.

Among other stuff, I'm using locktask mode in order to disable back button, home button, recent apps button and status bar. And this is all nice.
The problem is that icons (battery, wireless, ....) in status bar are not shown any more, this is not very nice for users .

This apps is intended to be used by company owned industrial devices, and it is very important for those icons to be shown all the time.

Is there any option that I can set in order to get those icons back?

Best Answer

  • NovakNovak CH ✭✭✭
    Accepted Answer

    So far it seems that there is no solution directly from Android API by settings some config parameters.

    The only workaround for me was to add foreground service as a part of my admin app (device owner):

    • it will add custom status bar once when admin app is running, even if activity from another app is running
    • it will remove cutom status bar when admin app is closed, or not device owner anymore
    • since the service is running in foreground it will not be destroyed in the case of low memory, meaning it will run as long as my admin app is running
    • custom status bar is just view at the same position and dimensions as original status bar that contains icons and test that is driven by values from data related to battery status, wireless...
    • for this I need permission to draw over other apps, to ask for this permission by opening Android settings...

    At the end, fully working solution, but not really optimal, since it will consume additional battery resources. I was hoping that Android has support to enable status bar icon.

    What is left is to measure the resource usage penalty, so how much my "custom status bar" consumers battery.

Answers

  • NovakNovak CHMember ✭✭✭
    Accepted Answer

    So far it seems that there is no solution directly from Android API by settings some config parameters.

    The only workaround for me was to add foreground service as a part of my admin app (device owner):

    • it will add custom status bar once when admin app is running, even if activity from another app is running
    • it will remove cutom status bar when admin app is closed, or not device owner anymore
    • since the service is running in foreground it will not be destroyed in the case of low memory, meaning it will run as long as my admin app is running
    • custom status bar is just view at the same position and dimensions as original status bar that contains icons and test that is driven by values from data related to battery status, wireless...
    • for this I need permission to draw over other apps, to ask for this permission by opening Android settings...

    At the end, fully working solution, but not really optimal, since it will consume additional battery resources. I was hoping that Android has support to enable status bar icon.

    What is left is to measure the resource usage penalty, so how much my "custom status bar" consumers battery.

Sign In or Register to comment.