mobizt / FirebaseClient

🔥Async Firebase Client for Arduino. Supports Realtime Database, Cloud Firestore Database, Firebase Storage, Cloud Messaging, Google Cloud Functions and Google Cloud Storage.
MIT License
129 stars 7 forks source link

How to send high priority notification? #10

Closed FI407 closed 7 months ago

FI407 commented 7 months ago

How to send high priority notification?

mobizt commented 7 months ago

I have no idea, please consult the Google Cloud Messaging documentation.

FI407 commented 7 months ago

Messages::Message msg; msg has a member : fcm_options has priority property how can use it?

mobizt commented 7 months ago

Please try.

Messages::AndroidConfig androidConfig;

// Priority of a message to send to Android devices.
// https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidmessagepriority
androidConfig.priority(Messages::AndroidMessagePriority::_HIGH);

Messages::AndroidNotification androidNotification;

// Set the relative priority for this notification.
// Priority is an indication of how much of the user's attention should be consumed by this notification.
// Low-priority notifications may be hidden from the user in certain situations,
// while the user might be interrupted for a higher-priority notification.
// https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#NotificationPriority
androidNotification.notification_priority(Messages::NotificationPriority::PRIORITY_HIGH);

androidConfig.notification(androidNotification);

msg.android(androidConfig);
mobizt commented 7 months ago

You can look at this file for the complete classes and enums that created and based on the JSON data representations and enumerations from Google Cloud Messaging REST API doc.

https://github.com/mobizt/FirebaseClient/blob/main/src/messaging/DataOptions.h

FI407 commented 7 months ago

Thank you @mobizt completely resolved.