title: Send push notification to mobile endpoint from C# application
body: <p>I'm using Amazon SNS for to send notifications. Currently i have realization where i can publish message to a some topic. But i need send push notification direct to Android device using GCM. Can somebody help me to implement it in C# code? 
  Here is my code for to publish message to topic:</p>
  
  <pre><code>private IAmazonSimpleNotificationService FAmazonSNS = null;
  
  
      public void Connect(string AAccessKey, string ASecretKey, bool AUseHTTP, string ARegion, int ATimeoutInMSec, int AReadWriteTimeoutInMSec, bool AConnectToSQS, bool AConnectToS3, bool AConnectToSNS)
      {
          AWSCredentials vAWSCredentials = new BasicAWSCredentials(AAccessKey, ASecretKey);
  
          if ((AConnectToSNS) &amp;&amp; (FAmazonSNS == null))
          {
              AmazonSimpleNotificationServiceConfig vAmazonSNSConfig = new AmazonSimpleNotificationServiceConfig();
              vAmazonSNSConfig.UseHttp = AUseHTTP;
              vAmazonSNSConfig.RegionEndpoint = RegionEndpoint.GetBySystemName(ARegion);
  
              if (ATimeoutInMSec != 0)
              { vAmazonSNSConfig.Timeout = TimeSpan.FromMilliseconds(ATimeoutInMSec); }
  
              if (AReadWriteTimeoutInMSec != 0)
              { vAmazonSNSConfig.ReadWriteTimeout = TimeSpan.FromMilliseconds(AReadWriteTimeoutInMSec); }
  
              FAmazonSNS = AWSClientFactory.CreateAmazonSimpleNotificationServiceClient(vAWSCredentials, vAmazonSNSConfig);
          }
      }
  
  public bool SNS_Publish(string ATopicARN, string ASubject, string AMessage, out int AStatusCode, out string AErrorCode, out string AErrorMessage)
      {
          try
          {
              PublishRequest vPublishRequest = new PublishRequest();
              vPublishRequest.TopicArn = ATopicARN;
              vPublishRequest.Subject = ASubject;
              vPublishRequest.Message = AMessage;
  
              //vPublishRequest.TargetArn
  
              PublishResponse vPublishResponse = FAmazonSNS.Publish(vPublishRequest);
  
              AStatusCode = (int)vPublishResponse.HttpStatusCode;
              AErrorCode = "";
              AErrorMessage = "";
              return (vPublishResponse.HttpStatusCode == System.Net.HttpStatusCode.OK);
          }
          catch (AmazonSimpleNotificationServiceException ex)
          {
              AStatusCode = (int)ex.StatusCode;
              AErrorCode = ex.ErrorCode;
              AErrorMessage = ex.Message;
              return false;
          }
          catch (Exception e)
          {
              AStatusCode = 0;
              AErrorCode = ""; //e.InnerException.Message;
              AErrorMessage = e.Message; // A WebException with status Timeout was thrown
              return false;
          }
  
      } 
  </code></pre>
  
  <p>So for me absolutelly not clear how i can set "Server API key", "Device token" which is needed for to send notification for to mobile endpoint.</p>
  
  <p>For java i found example how to do it but for C# not(</p>