//public WebResponse AddRegistrationIdsToDeviceGroup(List<string> ids, string notificationKey, string notificationKeyName = null) //{ // GcmDeviceGroupOptions deviceGroup = new GcmDeviceGroupOptions() // { // NotificationKeyName = notificationKeyName, // NotificationKey = notificationKey, // Operation = DeviceGroupOptionsConstants.Add, // RegistrationIds = ids // }; // SetupGcmMessageRequest(GCM_NOTIFICATION_URL); // return Send(deviceGroup); //} //public WebResponse RemoveRegistrationIdsFromDeviceGroup(List<string> ids, string notificationKey, string notificationKeyName = null) //{ // GcmDeviceGroupOptions deviceGroup = new GcmDeviceGroupOptions() // { // NotificationKeyName = notificationKey, // NotificationKey = notificationKey, // Operation = DeviceGroupOptionsConstants.Remove, // RegistrationIds = ids // }; // SetupGcmMessageRequest(GCM_NOTIFICATION_URL); // return Send(deviceGroup); //} public GcmInstanceIdResponse GetInstanceIdResponse(bool details, string instanceId) { GcmInstanceIdResponse response = Send <GcmInstanctIdRequest, GcmInstanceIdResponse>(new GcmInstanctIdRequest() { Details = details, InstanceId = instanceId }, GCM_INSTANCE_ID_URL); UpdateResponseStatusForGcmInstanceIdResponse(response); return(response); }
private void UpdateResponseStatusForGcmInstanceIdResponse(GcmInstanceIdResponse response) { switch (response.HttpWebResponse.StatusCode) { case HttpStatusCode.Forbidden: response.ResponseStatus = INSTANCE_ID_RESPONSE_STATUS.FORBIDDEN; break; case HttpStatusCode.Unauthorized: response.ResponseStatus = INSTANCE_ID_RESPONSE_STATUS.UNAUTHORIZED; break; case HttpStatusCode.BadRequest: response.ResponseStatus = INSTANCE_ID_RESPONSE_STATUS.BAD_REQUEST; break; case HttpStatusCode.ServiceUnavailable: response.ResponseStatus = INSTANCE_ID_RESPONSE_STATUS.SERVICE_UNAVAILABLE; break; default: break; } }