Jump to Navigation

Me on Twitter

  • @ak_anneka Je découvre ton travail : c'est génial et ça donne envie d'en avoir un chez soi ! 5 years 36 weeks ago
  • RT @ak_anneka: Je l'ai terminé ! I did it, I did it, yeah! #art #ink #artist #bird #tiny #objects #doodle #fun #color #red #yellow #ooak ht… 5 years 36 weeks ago
  • RT @Devoxx: 5 years 38 weeks ago
  • RT @esa: Our week in #space images, featuring an Earth view taken by @Astro_Alex on the Space Station, the #Aeolus satellite's Vega rocket… 5 years 39 weeks ago
  • Wow.... Huge reservoir of liquid water detected under the surface of Mars https://t.co/PsJpjY7uFC via @AAAS @EurekAlert 5 years 42 weeks ago
  • RT @ChromiumDev: 5 years 42 weeks ago
  • RT @rupl: 5 years 43 weeks ago
  • Sorry @instapaper I can't wait any longer for you to be back online for Europeans. I'm back to @Pocket 5 years 49 weeks ago
  • Today it's #aiparis. Let's See that... 5 years 49 weeks ago
  • RT @MKBHD: Confirmed: You learn WAY more outside your comfort zone than in it. 5 years 50 weeks ago

Notification API

android Tweaking Android Notifications

For SwitchDataSwitch, I wanted to provide users with a 1-click solution to enable and disable data traffic (2G/3G/...).
I chose the notification bar since it is a very accessible place, visible almost all the time and that can be expanded without stopping the running activity :

Expanding the notification bar 
The notification bar is usually presented in its reduced form (here the dark bar at the top of the screen with the smallest icons) but can be expanded by sliding it downwards.

Unfortunately, Android's Notification API is really made for instant notifications, not persistent ones, and that implies several inconveniences :

  • when creating a notification, the developer has to put an icon in the reduced notification bar, taking some precious space
  • by default an 'event timestamp' is shown next to the expanded content of the notification, which means nothing for a permanent service
  • there is no programmatic way to know if a notification is currently displayed or not

This article describes a way to create a notification that :

  • doesn't show up in the reduced notification bar
  • doesn't have a timestamp in the expanded notification bar
...
Syndicate content