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
From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines
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
-
-
-
-
-
-
-
(Locked)
Create and run a bound service6m 20s
-
(Locked)
Started services and background processing limits5m 24s
-
(Locked)
Play audio in a service with MediaPlayer5m 16s
-
(Locked)
Run a service in the foreground9m 45s
-
(Locked)
Send intents from a foreground notification5m 7s
-
(Locked)
Style a foreground notification2m 42s
-
(Locked)
-