I\'m actually a beginner in android and needs a lot of help. I have made an app with embedded database and now want to put it onto some dynamic location. Have simple form of dat
Yes you do need a key. Look at this http://developer.android.com/google/gcm/gs.html
First, we need to send data to/from the client for the example you set up (App engine connected with Android App) using
com.google.android.gcm.server.Sender helper class
Again, that helper class is step #4 and how to use it is in Writing the Server-side Application Server-side Application
Naturally then you want to persist or look up data. You can do that in the whatever class is used to send/receive messages (which of course uses the Sender helper class above)
Then the easiest and maybe best way for AppEngine if you are using Java is to use Objectify. Trust me or google it to see how good it is. https://code.google.com/p/objectify-appengine/
The docs for Objectify are really good and I didn't really have any trouble the first times.
Their simple example is:
@Entity
class Car {
@Id String vin; // Can be Long, long, or String
String color;
}
ofy().save().entity(new Car("123123", "red")).now();
Car c = ofy().load().type(Car.class).id("123123").get();
ofy().delete().entity(c);
I think you are good to go.
Summary:
YourMessageClass (on Appengine)
-- uses com.google.android.gcm.server.Sender to send/recieve data
-- uses Objectify to persist data.
The next question is where are you putting YourMessageClass. Will it be in a Servlet that is handling a short-lived request? (https://developers.google.com/appengine/docs/java/runtime#Requests_and_Servlets) Will it be in a long-running backend? (https://developers.google.com/appengine/docs/java/backends/) but that is beyond the scope of this discussion.