Chapter 7. Alerts and Notifications

In this chapter, we will cover the following topics:

  • Lights, Action, and Sound – getting the user's attention!
  • Creating a Toast using a custom layout
  • Displaying a message box with AlertDialog
  • Displaying a progress dialog
  • Lights, Action, and Sound Redux using Notifications
  • Creating a Media Player Notification
  • Making a Flashlight with a Heads-Up Notification

Introduction

Android provides many ways to notify your user—from non-visual methods, including sounds, lights, and vibration, to visual methods including Toasts, Dialogs, and Status Bar notifications.

Keep in mind, notifications distract your user, so it's a good idea to be very judicious when using any notification. Users like to be in control of their device (it is ...

Get Android Application Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.