public DeleteEndpoint ( |
||
request | Container for the necessary parameters to execute the DeleteEndpoint service method. | |
return | Amazon.SimpleNotificationService.Model.DeleteEndpointResponse |
public static void SNSMobilePushAPIsDeletePlatformEndpoint() { #region SNSMobilePushAPIsDeletePlatformEndpoint var snsClient = new AmazonSimpleNotificationServiceClient(); var request = new DeleteEndpointRequest { EndpointArn = "arn:aws:sns:us-east-1:80398EXAMPLE:" + "endpoint/GCM/TimeCardProcessingApplication/" + "d84b5f0d-7136-3bbe-9b42-4e001EXAMPLE" }; snsClient.DeleteEndpoint(request); #endregion }
public void DeleteEndpoint(string endpointarn) { try { using (var snsclient = new AmazonSimpleNotificationServiceClient(_accesskey, _secretkey)) { snsclient.DeleteEndpoint(new DeleteEndpointRequest() { EndpointArn = endpointarn }); } } catch (Exception ex) { throw new Exception("DeleteEndpoint " + ex.Message); } }
/// <summary> /// This is the main function for sending notification /// </summary> public void sendNotification() { foreach (Client client in clients) { int clientID = client.getClientID(); #region AWS connection - This code block is same for every push message type - This is the basic block. _client = new AmazonSimpleNotificationServiceClient("XXXXXXX", "XXXXXXXXXX", Amazon.RegionEndpoint.EUCentral1); string token = client.getPushToken(); Platfroms mobilOsType = client.getMobileType() == 0 ? Platfroms.IOS_PATFORM : Platfroms.ANDROID_PLATFORM; try { string applicationArn = ""; try { applicationArn = applications[(int)mobilOsType].getArn(); } catch { continue; } string endPointArn = createEndPointArn(token, applicationArn); if (string.IsNullOrEmpty(endPointArn)) { continue; } else { PublishRequest publishRequest = new PublishRequest(); Dictionary <string, string> messageMap = new Dictionary <string, string>(); messageMap.Add("default", "default message"); string platform = mobilOsType == 0 ? "APNS_SANDBOX" : "GCM"; // This application developed for IOS and Android if (mobilOsType != Platfroms.IOS_PATFORM && mobilOsType != Platfroms.ANDROID_PLATFORM) { continue; } int clientsID = client.getClientID(); Guid pushesID = client.getPushID(); string message = mobilOsType == 0 ? getAPNSMessage(notification, title, pushesID, clientsID) : getGCMMessage(notification, title, pushesID, clientsID); messageMap.Add(platform, message); publishRequest.TargetArn = endPointArn; publishRequest.MessageStructure = "json"; string messageJSON = ""; try { messageJSON = JsonConvert.SerializeObject(messageMap); } catch { continue; } try { publishRequest.Message = messageJSON; _client.Publish(publishRequest); } catch { continue; } try { // for deleting endPointArn DeleteEndpointRequest _request = new DeleteEndpointRequest(); _request.EndpointArn = endPointArn; _client.DeleteEndpoint(_request); } catch { continue; } } } catch { continue; } #endregion } }