From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines

Unlock this course with a free trial

Join today to access over 22,700 courses taught by industry experts.

Style a foreground notification

Style a foreground notification

- [Instructor] Foreground notifications are very simple visually by default, but you can add some interesting visuals to them with just a bit of code. The resulting notifications will look different from one version of android to the next. But on all versions, they can just be made a bit more visually compelling. Now to support this in this branch, I've added an image file to my drawable directory under resources. I've made it a webp file so it's as small as possible. And I've set the resolution to 1024 by 512. Depending on the device, these images can be cropped. So you want to put any useful information that's in the images, right in the center. On this image though it's just colors. So it doesn't really matter what the device does with it. In order to use that image, in the notification, it has to be turned into a bitmap in memory. So I'll add a little bit of code here, I'll create a variable that I'll call bitmap.…

Contents