0

Background: I am creating an Android app that will get data from a web page (that will be created by me) and parse it. This data can be in XML or JSON format. I would personally prefer JSON but if there is an easy way to achieve it with XML, I would most certainly use it. The app is a Live Score app. So, my page would have XML or JSON with the current score, the current time and minute by minute commentary.

Progress so far: My app is able to read and parse JSON data using the HttpGet and HttpResponse methods alongwith the JSONObject. My concern however is that I am unable to create a dynamic web page. I tried to create and host a page using Google App Engine and Python. The problem was that everytime I'd make changes to the JSON file, I would need to re-deploy the program from the Google App Engine to ensure that the changes are reflected on the URL. I felt this was relatively time consuming.

My Questions:

1.) Is there any way to host a dynamic web page? Preferably with Eclipse and Java. One that I can add the commentary to, as and when an event occurs and it is reflected on the page.

2.) I am not good with Web Services but would GET and POST be a better alternative as opposed to deploying my JSON file with the GAE? If so, how can I go about with that?

3.) Is GCM a good alternative for all this? I tried reading up some of the documentation but it seemed really complex to me.

Thanks.

Sid
  • 234
  • 1
  • 4
  • 14

1 Answers1

0
  1. Sure, it's called AJAX. It requires client-side (browser) javascript code making a request and server-side java code making a response. See: How to use Servlets and Ajax?

  2. Yes, you should use POST and GET to create/retrieve data on server. Your server-side java code should receive data on POST, save it to datastore, and then serve it back on GET. I'd suggest using objectify library for storing data, and GSON for converting java objects to JSON.

  3. GCM is an asynchronous way to notify Android apps (aka notifications) when apps are not running. While with GCM it's possible to send data both ways, it's more complex then plain POST/GET and also only works on Android devices with Google Play.

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Thanks a million for the detailed answer. It clarifies a lot of what I wanted to know. Just another question, what is a datastore? Is it just a database? – Sid Apr 10 '14 at 13:06