Apps

Android Jelly Bean ate my toast

Android app developer William J. Francis bids farewell to his once loyal companion the toast notification. Find out why.

Those of us who have been developing on Google's Android platform for a while have at one time or another run across a notification mechanism called toast. According to Google's official Android documentation: "A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive." The documentation goes on to describe some common scenarios for using toast messages.

I have a puzzle game in Google Play, and within my game I frequently use the toast construct to provide the user with hints as the game progresses. A while back, I even did a post for TechRepublic on how to customize toast messages. So now it is with a heavy heart that I have to bid farewell to my once loyal companion the toast notification.

Why? Well, because someone at Google either made a conscious decision to allow users to suppress toast messages, or, inadvertently linked toast notifications to the desktop notification shade. Either way, beginning with Jelly Bean, developers no longer have any guarantee toast notifications will display. For me this simply means I can't use them -- period. As far as I am concerned the framework team might as well of pulled the Toast API altogether.

It's a shame really, because there were so many instances where toast messages provided the user with system feedback in an unobtrusive manner. Now I find myself either reinventing the wheel (or rather toast) using the PopupWindow class or moving to a more traditional dialog. Applications already deployed that depend on toast messages to relay vital information to the user will have to be patched.

I'm all for giving users control, but my feeling is if an app is abusing notifications, the user ought to uninstall the offending app. In my humble opinion the new menu option adds confusion and puts unnecessary work on the developer.

Alright, I'm done whining. Below are screenshots of toast messages displaying and not displaying on Jelly Bean, along with the new settings option. If you have users reporting issues with notifications on your deployed apps, the settings menu is the place to start troubleshooting.

Figure A

Show notifications enabled.
Figure B

Toast displays.
Figure C

Show notifications disabled.
Figure D

Toast messages no longer display.

About

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...

0 comments