Azure / azure-notificationhubs-samples

Microsoft Azure Notification Hubs Samples
Apache License 2.0
162 stars 240 forks source link

Sending high priority message via GCM #19

Closed jd-alexander closed 8 years ago

jd-alexander commented 8 years ago

I'm using Notification Hub to send noifications to my Android aplication. My question is by default what priority does the SDK use to send notifications and can this be configured. Based on what I have seen on Google's website https://developers.google.com/cloud-messaging/concept-options?hl=en I can simply add the priority as part of the payload. However I am not sure how the underlying SDK handles this and if it adds a priority by default. This is what I did. The notification is being sent with the code below but I'm wondering if the priority value has any effect.

var payload = new { priority="high", data = new { message = new { model.Title, model.Time, model.Message, model.NotificationId, model.NotificationType, model.SenderFacebookId, model.TargetId, model.TargetUserFacebookId } } };

                var json = JsonConvert.SerializeObject(payload);
                await hub.SendGcmNativeNotificationAsync(json, Tag.UserDevice.GetStringValue() + deviceId);
wesmc7777 commented 8 years ago

This should work as expected with Azure notification hubs being basically pass-through. The priority would be handled by GCM.