如何使用谷歌应用引擎作为Android应用程序的后台数据库[英] How to use the Google App Engine as a backend database for Android applications

本文是小编为大家收集整理的关于如何使用谷歌应用引擎作为Android应用程序的后台数据库的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我实际上是Android的初学者,需要很多帮助.我已经制作了一个带有嵌入式数据库的应用程序,现在想将其放在一些动态位置上.具有简单的数据形式(某些地址和分支信息等).实际上,我不知道如何使用放置在动态位置上的动态服务器.

我该怎么做?请引导我逐步

我浏览并找到了一些术语,例如" Write Service "," 关闭/打开后端"等.请指导我.我遇到的另一个问题是:我是否需要某种注册,API-KEY或任何其他内容.我刚刚添加了Eclipse的" Google插件",我可以创建与Android App连接的应用程序引擎

推荐答案

是的,您确实需要一个键.查看此/a>

首先,我们需要在您设置的示例中向客户端发送数据(与Android App连接的应用引擎

com.google.android.gcm.server.Sender helper class

再次,该帮手类是步骤#4,如何使用它是编写服务器端应用程序服务器端应用程序

自然而然地想持续或查找数据.您可以在用于发送/接收消息的任何类中(当然使用上面的发送者助手类)

那么,如果您使用的是使用Java,则最简单,也许是Appengine的最佳方法. https://code.google.com/p/obignify-appengine/pappengine/

客观化的文档真的很好,我第一次没有任何麻烦.

他们的简单示例是:

@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);

我认为你很好.

摘要:

  • yourmessageclass(在附录)

    - 使用com.google.android.gcm.server.sender发送/接收数据

    - 使用Objectify持续数据.

下一个问题是您在哪里放置您的MessageClass.会在处理短期请求的servlet中吗? ( requests_and_servlets )是否会在长期运行的后端? ( https://develovelers.google.com/appein com.com/appine/pappens/docs/docs/docs/java/java/java/backends/),但这超出了讨论的范围.

本文地址:https://www.itbaoku.cn/post/597758.html

问题描述

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

推荐答案

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.