是否可以使用 Google App Engine 作为 Android 应用程序的后端数据库?

发布于 2024-08-15 09:38:21 字数 132 浏览 4 评论 0原文

我想为 Android 编写一个客户端应用程序,使用 Google App Engine 作为数据库后端。我的 Android 客户端将连接到 App Engine 以保存信息,然后稍后连接以获取报告。是否可以像这样使用App Engine作为后端?

I would like to write a client application for Android that uses the Google App Engine as a database backend. My Android client would connect to the App Engine to save information, then it would connect later for reports. Is it possible to use the App Engine as a backend like this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

一生独一 2024-08-22 09:38:21

如果您正在寻找 App Engine 在 Python 中具有的远程 api 之类的东西,那么您会很失望地发现它在 Java 中缺失。

也就是说,绝对没有什么可以阻止您访问您的应用程序并通过 POST / JSON / XML / 您能想到的任何其他格式发布数据。取回报告也是如此。

如果安全性是一个问题,OAuth 协议允许您从 Android 设备向应用程序引擎进行身份验证。

这是题外话,但就报告而言,您可能不会发现应用程序引擎是一个非常适合报告类型应用程序的平台。只需确保您了解其局限性 - 缺乏连接、1000 个对象限制、无总和/平均值、必要的索引等。这当然不是不可能的,但请仔细考虑如何对数据进行建模。

If you're looking for something like the remote api that the App Engine has in python, then you'll be disappointed to find it missing in Java.

That said, absolutely nothing stops your from hitting your app and posting data either through POST / JSON / XML / any other format you can think of. The same thing goes for getting your reports back.

If security is a concern, the OAuth protocol allows you to authenticate to app engine from your android device.

This is an aside, but as far as reporting is concerned, you might not find the app engine a very suitable platform for reporting type apps. Just make sure you understand its limitations - the lack of joins, 1000 object limit, no sum / average, necessary indexes, etc. It's certainly not impossible, but do think carefully about how you're going to model your data.

三生殊途 2024-08-22 09:38:21

是的,这是可能的。

如果您的问题没有更多细节,答案中的任何更多细节都将是猜测。

Yes, it is possible.

Without more details in your question, any more details in the answer would be speculation.

夜未央樱花落 2024-08-22 09:38:21

是的,这很有可能。这也是我目前正在做的事情。

我的代码使用 HTTP GET 和 HTTP POST,并且我在 GAE 上使用 RESTful 服务。

很抱歉我无法提供任何代码,因为我仍在学习,但是我使用的库称为 RESTLET。他们有适用于 GAE 和 Android 的库,但我仅在 GAE 上使用 RESTLET,并且仅在客户端的 Android SDK 中使用 HTTP 库。

http://www.restlet.org/

您需要的版本是 2.0 M6,而不是稳定版本。

Yes, its very much possible. It's something I am also currently working on.

My code uses HTTP GET and HTTP POST and I am using a RESTful service on the GAE.

I'm sorry I can't provide any code because I am still learning however the library I'm using is called RESTLET. They have libraries for both GAE and Android however I'm only using RESTLET on the GAE and I'm just using the HTTP library in the Android SDK for the client.

http://www.restlet.org/

The version you require is 2.0 M6 and not the stable release.

ペ泪落弦音 2024-08-22 09:38:21

不。

在您对 Laurence 的回复中,您说您想要直接的数据库连接。客户端无法直接连接到 GAE 数据存储。您必须编写 Web 处理程序来连接客户端和数据。不一定要很多,但一定是有的。

No.

In your response to Laurence, you said you want a direct DB connetion. A client cannot connect directly to the GAE datastore. You must write web handlers to interface between the client and your data. It doesn't have to be much, but it must be something.

残疾 2024-08-22 09:38:21

是的,这很有可能。但您不会直接连接到 GAE 数据库。更好的架构是让您的应用程序访问写入数据库的 URL。例如,您可以设置一个采用查询值的 Struts 2 操作参数,然后根据需要对其进行变异和验证,然后再保留它们。

Yes, it is very possible. You would not connect directly to the GAE database though. A better architecture would be to make your app hit a URL that writes to the DB. For example, you could set up a Struts 2 action that takes the values of your query parameters and then mutates and validates them as necessary before persisting them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文