简体   繁体   English

如何从Android中的Google App Engine数据存储区中获取数据

[英]how to fetch data from google app engine datastore in android

i'm new to google app engine and i follow it's documentation at https://developers.google.com/appengine/docs/ carefully.Now I've successfully stored my data on google app engine store by creating web application in eclipse for example i store first and last name of employee at GAE store like 我是Google App Engine的新手, 仔细阅读https://developers.google.com/appengine/docs/上的说明文件。现在,通过在eclipse中创建Web应用程序,我已成功将数据存储在Google App Engine商店中例如我在GAE商店中存储员工的名字和姓氏,例如

DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();


Entity employee = new Entity("Employee");

employee.setProperty("firstName", "Antonio");
employee.setProperty("lastName", "Salieri");

Date hireDate = new Date();
employee.setProperty("hireDate", hireDate);

employee.setProperty("attendedHrTraining", true);


datastore.put(employee);

and i've also deployed my project to GAE but now i want to get that stored data from data store in my android app. 而且我也已经将项目部署到GAE,但现在我想从Android应用程序中的数据存储中获取存储的数据。 is this possible to do that. 这有可能做到吗 any help would me much appreciated. 任何帮助我将不胜感激。

Thanks! 谢谢!

There different approaches to this problem. 有不同的方法来解决此问题。 Usually you would create some kind of services, most likely in JSON format and then you'll be able to interact from your Android app with Google App Engine using HTTP requests. 通常,您会创建某种服务,最有可能采用JSON格式,然后就可以使用HTTP请求从Android应用程序与Google App Engine进行交互。 Even better solution though would be to use the Google Cloud Endpoints : 更好的解决方案是使用Google Cloud Endpoints

Google Cloud Endpoints consists of tools, libraries and capabilities that allow you to generate Endpoints and client libraries from an App Engine backend to simplify client access to that web app. Google Cloud Endpoints包含工具,库和功能,可让您从App Engine后端生成Endpoints和客户端库,以简化客户端对该Web应用程序的访问。 Endpoints makes it easier to create a web backend for web clients and mobile clients such as Android or Apple's iOS. 端点使为Web客户端和移动客户端(例如Android或Apple的iOS)创建Web后端变得更加容易。

        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        Query q = new Query("Student");

        PreparedQuery pq = datastore.prepare(q);


        for (Entity entity : pq.asIterable()) 
{

        String nm=(String)entity.getProperty("Name");
        String em=(String)entity.getProperty("E-Mail");
    }
     resp.getWriter().println((String)entity.getProperty("Name"));

          resp.getWriter().println((String)entity.getProperty("E-Mail"));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Google App Engine数据存储区获取的内容不一致 - Inconsistent Fetch From Google App Engine Datastore 如何使用谷歌应用程序引擎从数据存储区检索信息,并使用Java在Android应用程序的列表视图中显示它? - how to retrieve info from datastore using google app engine and display it in a list view on an android app using java? 我从GAE上的数据存储中丢失了数据,Google App Engine如何帮助恢复我的数据 - I lost my data from datastore on GAE how Google app engine helps to restore my data 如何将数据放入Google应用引擎的数据存储区? - How do I put data into the datastore of Google's app engine? Google App Engine数据存储区,如何处理数据不一致? - Google App Engine Datastore, how to deal with data inconsistency? 将 android 应用程序与谷歌应用程序引擎数据存储链接 - linking android application with google app engine datastore 如何从Google App Engine数据存储中获取数据到客户端的Angular JS中? - How to get the data from google app engine datastore into angular js which at client side? 有人知道如何将 Java 数据从谷歌应用引擎数据存储导出到融合表吗? - Anybody knows how to export in Java data from google app engine datastore to fusion tables ? 如何限制来自Google App Engine数据存储区的结果? - how to limit the results from datastore of google app engine.? 如何从Google App Engine数据存储区(Java)正确检索int? - How to correctly retrieve int from a Google App Engine datastore (Java)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM