private ApiCallResult ProcessGoogleGcmNotification(GoogleGcmApiNotificationPayLoad payLoad) { var result = new PushNotificationApiCallResult(false, "Notificaiton failed.", payLoad.DeviceUuid, payLoad.Message); var isRequestValid = _SecurityService.ValidateRequestKey(payLoad.AuthenticationKey); if (!isRequestValid) { result.Message = "Invalid Authentication Key"; } else if (_GoogleGcmService.Send(payLoad)) { result.IsSuccessful = _GoogleGcmService.Result.IsSuccessful; result.Message = _GoogleGcmService.Result.Message; } return result; }
public bool Send(GoogleGcmApiNotificationPayLoad payLoad) { HookEvents(PushBroker); try { PushBroker.RegisterService<GcmNotification>(new GcmPushService(new GcmPushChannelSettings(_Settings.GoogleApiAccessKey))); var notification = new GcmNotification() .ForDeviceRegistrationId(payLoad.Token) .WithJson(payLoad.GetGoogleFormattedJson()); PushBroker.QueueNotification(notification); } finally { StopBroker(); } return true; }
public ApiCallResult GoogleGcm(GoogleGcmApiNotificationPayLoad payLoad) { return ProcessGoogleGcmNotification(payLoad); }