I am able to make an entry in the notification bar for my app, but I want to make an icon for my app in the status bar, where battery, wi-fi, bluetooth,time icons are shown. I have searched about this, but got this much- it can't be controlled from the app only, while building android ,some-where in the frameworks directory of android source-code we have to put some lines to get it done, I don't have any clue how is it managed.
Android Status Bar icons are notifications in the graphical user interface (GUI) from apps running on your device. These notifications can contain text, graphics, and even controls.
To customize it, first pull down the slider bar from the top of the screen. Next, tap on the three vertical dots in the top right corner. Now click on Status bar. You're in.
Call, Alarm, and Volume There's a similar phone icon with an arrow diverting from it, which signifies a missed call. If you ever try out WiFi calling you'll see a WiFi sign with the phone icon integrated into it. Besides call signs, the status bar also has unique symbols for the volume setting on your phone.
Sorry I don't have enough reputation to add this as a comment, but have you looked at similar questions like these?. You can add a drawable resource for the icon you want and set flags on your notification so that should allow the icon to remain in the status bar. FLAG_NO_CLEAR
and FLAG_ONGOING_EVENT
can allow you to make an icon appear in the status bar as the answerd to these questions describes.
How to show an icon in the status bar when application is running, including in the background?
controlling the android status bar icon
If you have a full checkout of AOSP I would recommend checking out the StatusBarManager service then. The notification uses callbacks inside of this service when showing notificatons. There is also a binder interface that allows setting icons.
in /frameworks/base/services/java/com/android/server/StatusBarManagerService.java and
/frameworks/base/core/java/com/android/internal/statusbar/IStatusBarService.aidl
void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
void setIconVisibility(String slot, boolean visible);
in /frameworks/base/core/res/res/values/config.xml
<item><xliff:g id="id">ime</xliff:g></item>
<item><xliff:g id="id">sync_failing</xliff:g></item>
<item><xliff:g id="id">sync_active</xliff:g></item>
<item><xliff:g id="id">gps</xliff:g></item>
<item><xliff:g id="id">bluetooth</xliff:g></item>
<item><xliff:g id="id">nfc</xliff:g></item>
<item><xliff:g id="id">tty</xliff:g></item>
<item><xliff:g id="id">speakerphone</xliff:g></item>
<item><xliff:g id="id">mute</xliff:g></item>
<item><xliff:g id="id">volume</xliff:g></item>
<item><xliff:g id="id">wifi</xliff:g></item>
<item><xliff:g id="id">cdma_eri</xliff:g></item>
<item><xliff:g id="id">data_connection</xliff:g></item>
<item><xliff:g id="id">phone_evdo_signal</xliff:g></item>
<item><xliff:g id="id">phone_signal</xliff:g></item>
<item><xliff:g id="id">battery</xliff:g></item>
<item><xliff:g id="id">alarm_clock</xliff:g></item>
<item><xliff:g id="id">secure</xliff:g></item>
<item><xliff:g id="id">clock</xliff:g></item>
the are the values for slots that get added by default to the statusbar
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With