Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set notification channel when sending messages via rest api?

I've been implementing Notification Channels in my android app to support recent android versions.

You can set the notification channel id when sending messages from the firebase web console, but I was not able to find out how to set the channel id when sending messages via fcm rest api.

Notification channels are not mentioned in the reference (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages), but I am pretty sure there must be a way to set the channel id.

like image 614
linnedude Avatar asked Aug 29 '18 07:08

linnedude


People also ask

How do I set notification channels on Android?

To create a notification channel, follow these steps: Construct a NotificationChannel object with a unique channel ID, a user-visible name, and an importance level. Optionally, specify the description that the user sees in the system settings with setDescription() .

What is push notification channel?

Android Push Notification Channels were introduced in Android Oreo (Android 8.0 / API Level 26) to provide a unified system to help users manage their notifications.

What is a data notification channel?

Starting with Android 8.0, apps are required to assign their notifications to so-called “notification channels”. These channels determine which signals (notification sound, light, vibration, etc.) incoming notifications trigger.


1 Answers

The key name I was missing is android_channel_id

I found the key name in the Legacy HTTP Server Protocol docs (https://firebase.google.com/docs/cloud-messaging/http-server-ref)

like image 144
linnedude Avatar answered Oct 01 '22 02:10

linnedude