Customize Firebase Notifications

1,275 views
Skip to first unread message

Trey Ethridge

unread,
Jun 6, 2016, 6:23:48 PM6/6/16
to Firebase Google Group
I've got notifications configured with my application.  They work, but they are very simple.  Can somebody point me to some documentation that explains how to set the notification icon, actions, styles, and the content intent?  I would like access to all the features that NotificationCompat.Builder typically exposes.

Frank van Puffelen

unread,
Jun 7, 2016, 6:23:37 PM6/7/16
to Firebase Google Group
Hey Trey,

Unfortunately those types of customizations are currently beyond what Firebase Notifications allow. See this post on StackOverflow for more information: http://stackoverflow.com/questions/37325051/notification-icon-with-the-new-firebase-cloud-messaging-system

     puf

Trey Ethridge

unread,
Jun 8, 2016, 2:32:21 PM6/8/16
to Firebase Google Group
At I/O, I asked about having one of our servers programmatically post notifications through Firebase.  I was assured that it was possible and that you can configure everything including the icon and actions.  I assume that is through an existing REST api, but I can't find any documentation about it.  Was I told wrong at I/O?

To be clear, I'm not referring to GCM messages, but instead our server instructing Firebase to display a notification to our users programmatically.

Thanks!

Frank van Puffelen

unread,
Jun 8, 2016, 5:07:20 PM6/8/16
to Firebase Google Group
I had to ask around a bit, but this seems to be what's happening. When you send a message from the Firebase Console, it is sent as a Notification. If the Android app is active, your FirebaseMessagingService subclass is invoked and can handle the message as it sees fit. If the Android app is not active, a default handling is invoked that determines what icon to display automatically.

If you have a server sending the messages, you can send them as a data message and it'll always be your own code displaying the notification (and thus determining its formatting). For more information see how our quickstart app handles notifications (you'll want to use to use msg.getData() to handle data messages). Also have a look at this issue, which describes (what I think is) the same.

If this is not what you mean, can you post the minimal code that shows how you're sending the messages and how your app is handling them?

    puf
Reply all
Reply to author
Forward
0 new messages