Search code examples
javaandroidnotificationsandroid-8.0-oreocustom-notification

Build a collapsible notification menu like Google Weather


I am developing a simple Android app and I'm trying to build a notification exactly like Google weather looks like on Android Oreo:

  • should be collapsed by default
  • should be grayed out
  • when notification is expanded, the notification subtext should be displayed as content

enter image description here

enter image description here

I had a look on the official Android docs (https://developer.android.com/training/notify-user/expanded#java) but I haven't found exactly what I need.

Is the grayed out notification something specific to system background processes? Can someone please provide a hint regarding this notification style type (especially on the expanded thing)?

Many thanks!


Solution

  • What you need to do is create a Notification Channel with its priority set to IMPORTANCE_MIN, then use that channel to create your notification. Check this for more explanation.