How to implement aws api gateway into android?
<p>So i deployed an api and imported the sdk into android. I tried to perform a simple GET method. Where I input a <code>userName</code> and it returns to me the user's <code>lastName</code>. </p>

<p>The lambda function (backend function) is called, so i am able to connect to it, but im not able to get the output.</p>

<p>Here is my class:</p>

<pre><code>public class SampleGet extends AppCompatActivity
{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_log_in);

        gatewayButton = (Button) findViewById(R.id.cognito_gatewayButton);
        gatewayButton.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                gateWayAsyncTask gateWayAsyncTask = new gateWayAsyncTask();
                gateWayAsyncTask.execute();

            }
        });
    }

    class gateWayAsyncTask extends AsyncTask&lt;Void, Void, Void&gt;
    {
        private String userName;
        @Override
        protected Void doInBackground(Void... params)
        {
            //gateway
            creatingUser = clientFactory.build(MyUserClient.class);
            userName = creatingUser.rootGet("SampleUserName").getLastName;
            return null;
        }
        @Override
        public void onPostExecute(Void var)
        {
            Log.d("gateway","gateway succeded!");
            if( userName == null)
            {
                Log.d("gateway","username is null");
            }
            else if(userName.equals(""))
            {
                Log.d("gateway","username is empty");
            }
            else
            {
                Log.d("gateway",userName);
            }

        }
    }
</code></pre>

<p>In the sdk i generated from api gateway here is the client class:</p>

<pre><code>@com.amazonaws.mobileconnectors.apigateway.annotation.Service(endpoint = "https://ow2zhiry2b.execute-api.us-west-2.amazonaws.com/test5")

public interface MyUserClient {


    /**
     * A generic invoker to invoke any API Gateway endpoint.
     * @param request
     * @return ApiResponse
     */
    com.amazonaws.mobileconnectors.apigateway.ApiResponse execute(com.amazonaws.mobileconnectors.apigateway.ApiRequest request);

    /**
     * 
     * 
     * @param username 
     * @return AndroidOutput
     */
    @com.amazonaws.mobileconnectors.apigateway.annotation.Operation(path = "/", method = "GET")
    AndroidOutput rootGet(
            @com.amazonaws.mobileconnectors.apigateway.annotation.Parameter(name = "username", location = "query")
            String username);

}
</code></pre>

<p>Here is the AndroidOuput class which was also generated:</p>

<pre><code>public class AndroidOutput {
    @com.google.gson.annotations.SerializedName("items")
    private String items = null;

    /**
     * Gets items
     *
     * @return items
     **/
    public String getItems() {
        return items;
    }

    /**
     * Sets the value of items.
     *
     * @param items the new value
     */
    public void setItems(String items) {
        this.items = items;
    }

}
</code></pre>

<p>So the log that comes out is <code>username is null</code> and i have no idea why. I have checked the cloudwatch, and indeed my backend lambda function is running. And when i test the api in gateway it ran there. If anyone could please help me thatd be awesome!!</p>