Programmer
Programmer

Reputation: 878

How to debug app engine backend with Google Cloud Messaging code in android studio

I am beginner in Google Cloud messaging with App engine backend area. I followed tutorial https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints.

I deployed code to app engine development server by going "Build -> Deploy module to App Engine". It deployed successfully.

I send message from https://project-id.appspot.com/_ah/api/explorer messaging API. (Please note that project-id is the real id in my code)

I got the message on my device. But I want to debug the code at server side. How do I debug server side code?

Upvotes: 1

Views: 338

Answers (2)

Marlhex
Marlhex

Reputation: 1979

you can debug your server side code via Sout (System.out.println)

This is an example of how I am doing it

if (result.isSuccess()) {

    Transaction transaction = result.getTarget();
    transaction.getStatus();
    System.out.println("message: " + result.getMessage());
    System.out.println("transaction: " + result.getTarget());
    System.out.println("status: " + result.getTarget().getStatus());
    resp.getWriter().println("Thanks for the purchase (: ");

} else {

  ValidationErrors errors = result.getErrors();
  System.out.println(result.getErrors());
  resp.getWriter().println("Payment Failed " + errors.toString());

 }

Upvotes: 0

Enoobong
Enoobong

Reputation: 1734

You debug your server side code on your development machine then deploy it to the cloud app engine, you can do this as many times as needed, it simply overwrites the present instance. You can test the your app engine locally first by simply running it - it would be accessible at localhost:8080

Upvotes: 0

Related Questions