I’m working on a project for android as a beginner on Processing. I would like to know if anyone knows how to show the notification bar and change its color. I’ve tried with android developer’s guide, but I’m still stuck.
you can do that using the NotificationManager API from Android + NotificationService and an intent (pending intent); for calling all this stuff you can create some button, adding to it an onClickListener. As for the background color (and other things of this kind - title,icon, contents…) you set them when you build your notification: myBuilder.setContentTitle (“monTitre”)…and so on.
I can give more details but first of all i want to see what you have tried.
Thanks a lot. I’ve been stupid enough to confuse notification with status bar. Sorry.
What I would like to do is to keep showing the status bar in purple while the app is running fullscreen.
I’ve tried what some people do in these links:
But I’m a newbie, as you might already imagined.
- you can rather easily show the status bar even in full screen, using from android WindowManager and flags
- but i cannot see the way to change the status bar background color , because it seems that this color is set by the background() method: so if you want to change the background status color to purple you can only change the background() to purple! - Though with android native and Android Studio you have only to call (example)“window.setStatusBarColor(Color.parseColor(”#0A45F2")); But this call seems to be overriden in processing by the standard background() method.
- the only solution i can see is to create a layout behind the status bar (some rect) but it is a very bad workaround…Yet, it works (tried with M)
- Anyway you have also to know that all this stuff can only be done when targetting min SdK >= lollipop.