We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e81a6e commit 211c0ebCopy full SHA for 211c0eb
PushSharp.Google/GcmNotification.cs
@@ -141,7 +141,15 @@ public bool IsDeviceRegistrationIdValid ()
141
142
internal string GetJson ()
143
{
144
- return JsonConvert.SerializeObject (this);
+ // If 'To' was used instead of RegistrationIds, let's make RegistrationId's null
145
+ // so we don't serialize an empty array for this property
146
+ // otherwise, google will complain that we specified both instead
147
+ if (RegistrationIds != null && RegistrationIds.Count <= 0 && !string.IsNullOrEmpty (To))
148
+ RegistrationIds = null;
149
+
150
+ // Ignore null values
151
+ return JsonConvert.SerializeObject (this,
152
+ new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
153
}
154
155
public override string ToString ()
0 commit comments