Jump to Navigation

Me on Twitter

  • RT @liamstack: This may be my favorite image from the pandemic https://t.co/bx8MZ3bGYX 3 years 25 weeks ago
  • RT @ThePracticalDev: Technology is the fastest-growing industry nowadays, which requires developers to keep up with all the improvements go… 3 years 25 weeks ago
  • Typical #antipattern in #mobile #French apps : blocking app access unless you update it. Don't they know about #API versioning ??? 3 years 25 weeks ago
  • RT @ArtifactsHub_: Ancient Egyptian dental work from 2000 BC https://t.co/9C0tGqu5wC 3 years 26 weeks ago
  • Excellent site about #batteries How to Prolong Lithium-based Batteries - Battery University - https://t.co/H8hUTm38qX 3 years 26 weeks ago
  • RT @SwiftOnSecurity: Breaking: CDC says fully-vaccinated people can turn off SMS 2FA, use the same password for everything again. 3 years 28 weeks ago
  • RT @acupoftim: [1/4] Bonsoir ! Demain sort ma nouvelle bd, "CANEVAS" et à ce sujet j'ai une minuscule demande à faire à vous qui aurez bien… 3 years 28 weeks ago
  • Solar System Cartogram - https://t.co/qU2p1x0WGY 3 years 35 weeks ago
  • RT @moshhamedani: #geek #humor https://t.co/mIVimI89Se 3 years 36 weeks ago
  • J'ai appris des choses https://t.co/kKMpCJ0TAr 3 years 36 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