Jump to Navigation

Me on Twitter

  • énergie gratuite ! 1 week 2 days ago
  • @DianeDCD énergie gratuite ! 1 week 2 days ago
  • RT @clochix: Ça y est, MDN Plus est disponible en france, vous pouvez à présent soutenir financièrement cet effort pour proposer une docume… 3 weeks 3 days ago
  • @elonmusk @BTC_Archive Don't spend your money, there is already a platform for freedom of speech #mastodon https://t.co/0MXYtfx1HP 5 weeks 6 days ago
  • RT @LavanyaSunder: Grateful and humbled to announce that I am one of the most powerful humans in the world https://t.co/z6eVcg5JIX https://… 9 weeks 6 days ago
  • RT @Fighters_Gen: 13 weeks 5 days ago
  • RT @StreetArtUtopia: This mural reveals its full meaning when looking at its reflection in the water. https://t.co/jzfaqF6xng 16 weeks 3 days ago
  • RT @MaximeEuziere: Day 26: Quintessence: a game I made with @subzey for #js13kgames 2014. It's kind of a mix of god game and candy crush..… 17 weeks 1 day ago
  • RT @ScottDuncanWX: 142 years of climate change in 15 seconds https://t.co/cLm3jDHJEd 17 weeks 4 days ago
  • RT @gregory_raymond: Si le #Bitcoin passe sous les 28.500$, tous les acteurs ayant investi en 2021 seront en moins-value Pour ceux qui ont… 17 weeks 4 days 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