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

查看:170
本文介绍了如何使用谷歌应用程序引擎作为后端数据库的Andr​​oid应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我其实在android的初学者,需要很多帮助。我与嵌入式数据库的应用程序,现在希望把它放到一些动态位置。有数据的简单形式(有的地址和分支信息等)。其实,我不知道如何使用放在动态位置动态服务器。

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

我浏览,发现了一些像编写服务关闭/打开后端等,请不要引导我。另一个问题,我有是:我需要某种形式的注册,API密钥或任何其他东西的。我只是说谷歌插件的日食,我可以创建应用引擎和Android应用程序连接

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

推荐答案

是的,你确实需要一个密钥。看看这个<一href="http://developer.android.com/google/gcm/gs.html">http://developer.android.com/google/gcm/gs.html

Yes you do need a key. Look at this http://developer.android.com/google/gcm/gs.html

首先,我们需要将数据从客户端作为您设置的例子(的应用引擎,Android应用程序连接)

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

此外,该助手类第4步,以及如何使用它在编写服务器机端应用程序服务器端应用程序

当然,你要坚持,或查找数据。您可以做,在任何类用于发送/接收邮件(当然,它使用上述发件​​人辅助类)

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)

的AppEngine上,如果你使用的是Java那么最简单的,也许最好的办法是用客观化。的相信我,或谷歌它,看看它有多好。 <一href="https://$c$c.google.com/p/objectify-appengine/">https://$c$c.google.com/p/objectify-appengine/

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.

他们简单的例子是:

@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.

摘要:

  • YourMessageClass(上AppEngine上)

  • YourMessageClass (on Appengine)

- 使用com.google.android.gcm.server.Sender发送/接受她的数据。

-- uses com.google.android.gcm.server.Sender to send/recieve data

- 使用物化坚持数据

-- uses Objectify to persist data.

接下来的问题是,你在哪里把YourMessageClass。会不会是正在处理一个短命的请求一个Servlet? (<一href="https://developers.google.com/appengine/docs/java/runtime#Requests_and_Servlets">https://developers.google.com/appengine/docs/java/runtime#Requests_and_Servlets)会不会是一个长期运行的后台?(<一href="https://developers.google.com/appengine/docs/java/backends/">https://developers.google.com/appengine/docs/java/backends/)但这超出了本文的讨论范围之内。

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.

这篇关于如何使用谷歌应用程序引擎作为后端数据库的Andr​​oid应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆