Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Notification \ status bar icon on the right side?

Ok I saw a lot of people just dismiss this question by saying

"it's reserved for OS component "

"it requires access to source"

Well I have access to the source and I can set any app or widget I want as a system app. So now how would I go about making my widget show its notification on the right side?

EDIT: ok ppl are going in the wrong direction so ill add come context here . . . look at ur phone . . . u see Wi-Fi signal and phone signal on the right side of the phone all the time right. I want my signal to be shown there aswell . . . along with the system signals . . I have a new hardware chip in the tablet my company is making and I have to display its signal strength constantly just like the phone signal. It is going to be integrated into the Android source of the tablet.

like image 337
Prince Champappilly Avatar asked Aug 21 '13 06:08

Prince Champappilly


2 Answers

You might need to refer to the code of Android source code of phone status bar, at https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r3.1/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

And take a look at the methods like

addIcon
updateIcon
removeIcon

It is not easy task since you have to add lots of stuff by yourself.

like image 74
Robin Avatar answered Oct 20 '22 01:10

Robin


You'll need to modify a few places:

framework/base/core/res/res/values/config.xml, add a slot in: <string-array name="config_statusBarIcons">

then frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java:

mService.setIcon("<your slot name>", R.drawable.yourlogo, 0, null);
mService.setIconVisibility("<your slot name>", setVisible);

That's mostly it, I'm sure you can figure out the rest on your own with some trial and errors.

like image 29
user3460295 Avatar answered Oct 20 '22 03:10

user3460295