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 data (some addresses and branch information etc). I actually have no idea about how to use a dynamic server placed on dynamic location.
How can I do this? Please guide me stepwise
I browsed and found some terms like "write Service", "Close/open back-ends" etc. Kindly do guide me. Another question that I have is: do I need some kind of registration, api-key or any other thing. I just added the "google plugins" for eclipse and I can create App engine connected with Android App
In Android Studio, open an existing Android application that you want to modify, or create a new one. Select the Android app module under the Project node. Then click Tools > Google Cloud Endpoints > Create App Engine Backend. In the wizard, enter the Project ID, Project Number, and API Key of your Cloud project.
The Google App Engine is a platform for building scalable web applications and mobile backends. The App Engine provides you with built-in services and APIs such as NoSQL datastores, memcache, and a user authentication API, which is common to most applications (source two).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With