Making a Flashlight with a Heads-Up Notification

Android 5.0—Lollipop (API 21) introduced a new type of notification called the Heads-Up Notification. Many people do not care for this new notification as it can be extremely intrusive, as it forces its way on top of other apps. (See the following screenshot.) Keep this in mind when using this type of notification. We're going to demonstrate the Heads-Up Notification with a Flashlight as this demonstrates a good use-case scenario.

Here's a screenshot showing the Heads-Up Notification we'll create further on:

Making a Flashlight with a Heads-Up Notification

If you have a device running Android 6.0, you may have noticed the new Flashlight settings option. ...

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.