title: Push notifications not received when called inside android app - Amazon SNS
body: <p>I have a problem with my app based on AWS. When I test the following function in Amazon lambda, everything works (I get the push notification on my phone):</p>
  
  <pre><code>console.log("Loading kupa function");
  var AWS = require("aws-sdk");
  
  exports.handler = function(event, context) {
  
      var eventText = JSON.stringify(event, null, 2);
      console.log("Received event:", eventText);
      var sns = new AWS.SNS();
      var params = {
          Message: eventText, 
          Subject: "Test SNS From Lambda",
          TopicArn: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      };
      sns.publish(params, context.done);
  
      context.succeed("kupa sukces");
  
  };
  </code></pre>
  
  <p>However, once I use the following method on my phone I get the "kupa sukces" log into my Android Studio but I don't get the notification on the phone. Furthermore, the "Test" on Lambda does not work anymore as wel...
  Here is the code:</p>
  
  <pre><code>String lambdaRequest = "{\n\"kupa\" : \"" + true + "\"\n}";
  
          asyncTask.delegate = wysylaczKupy.this;
          asyncTask.friendFunction("friendsRequest",lambdaRequest);
              }
  </code></pre>
  
  <p>the friendFunction is here:</p>
  
  <pre><code>public static void friendFunction(String funName, String requestContent) {
  
  
          final String functionName = funName;
          final String requestPayload = requestContent;
  
          new AsyncTask&lt;Void, Void, InvokeResult&gt;() {
              @Override
              protected InvokeResult doInBackground(Void... params) {
                  try {
                      final ByteBuffer payload =
                              ENCODER.encode(CharBuffer.wrap(requestPayload));
  
                      final InvokeRequest invokeRequest =
                              new InvokeRequest()
                                      .withFunctionName(functionName)
                                      .withInvocationType(InvocationType.RequestResponse)
                                      .withPayload(payload);
  
                      final InvokeResult invokeResult =
                              AWSMobileClient
                                      .defaultMobileClient()
                                      .getCloudFunctionClient()
                                      .invoke(invokeRequest);
  
                      return invokeResult;
                  } catch (final Exception e) {
                      Log.e("LAMBDA", "AWS Lambda invocation failed : " + e.getMessage(), e);
                      final InvokeResult result = new InvokeResult();
                      result.setStatusCode(500);
                      result.setFunctionError(e.getMessage());
                      return result;
                  }
              }
  }
  </code></pre>
  
  <p>How can I fix this?</p>
  
  <p>Thank you in advance,
  Jan</p>