简体   繁体   English

如何连接谷歌应用程序引擎应用程序与我的Android?

[英]How can i connect a google app-engine application with my android?

I've a application deployed on google app-engine..it has a registration form. 我在google app-engine上部署了一个应用程序。它有一个注册表单。 now i've made a registration form in my android application and i want that on click submit...it should be sent to the application on google app-engine and it should be persisted in the particular db... 现在我已经在我的Android应用程序中创建了一个注册表单,我想要点击提交...它应该发送到谷歌app-engine上的应用程序,它应该保存在特定的数据库中...

somebody told me to use http request and response method but i'm not aware of that thing.. can somebody please provide me with some sample code or something..... 有人告诉我使用http请求和响应方法,但我不知道那件事..有人可以请给我一些示例代码或什么.....

thanksss.... thanksss ....

You haven't specified if you're using Python or Java. 您尚未指定是使用Python还是Java。

You have to decide how you want to connect. 您必须决定如何连接。 At the simplest level you could just POST the data to Google App Engine. 在最简单的级别,您可以将数据发布到Google App Engine。 In Java you would write a servlet which handles this. 在Java中,您将编写一个处理此问题的servlet。 See Java EE tutorial . 请参阅Java EE教程 Alternatively you could write a web service (SOAP, RESTful) on the server which handles the data being sent from your application. 或者,您可以在服务器上编写Web服务(SOAP,RESTful),该服务处理从您的应用程序发送的数据。 Again Google this and there are countless examples. 谷歌这个和那里有无数的例子。

Assume we're going down the simplest POST route. 假设我们正在走最简单的POST路线。 So in your servlet (running on GAE) you'd have something like this: 所以在你的servlet(在GAE上运行)你会有这样的东西:

public void doPost(HttpServletRequest request, 
        HttpServletResponse response) throws ServletException, IOException {

      String value1 = request.getParameter("value1");
}

And in your android app you'd do something like: 在你的Android应用程序中你会做类似的事情:

DefaultHttpClient hc=new DefaultHttpClient();
ResponseHandler <String> res=new BasicResponseHandler();
HttpPost postMethod=new HttpPost("http://mywebsite.com/mappedurl");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();  
nameValuePairs.add(new BasicNameValuePair("value1", "Value my user entered"));  
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));  
String response=hc.execute(postMethod,res);

Of course value1 in the servlet would be set to "Value my user entered". 当然,servlet中的value1将设置为“Value my user entered”。

EDIT: Google have now released their Google Cloud Endpoints - this makes building RESTful services on App Engine and creating clients for Android a lot easier. 编辑:Google现已发布了他们的Google Cloud Endpoints - 这使得在App Engine上构建RESTful服务并为Android创建客户端变得更加容易。 It does tie you in to App Engine even more though - but certainly worthy of consideration. 它确实将你与App Engine联系起来 - 但是当然值得考虑。

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

相关问题 如何将Android App与App Engine上的数据存储连接 - How to connect android app with data store on app-engine 如何将我的 Android 应用程序连接到谷歌驱动器? - How can i connect my Android app to google drive? gitignore用于App引擎连接的android项目 - gitignore for App-engine connected android project 如何在不更改任何设备设置的情况下在我的 android 应用程序中使用日语谷歌 tts 引擎 - how can i use japanese google tts engine in my android app without change any device setting 更改的App-Engine Connected Android项目的App-Engine端的包名称未反映在Android Side - Changing package name of App-Engine side of App-Engine Connected Android Project not reflected on Android Side google-cloud端点应用程序引擎连接的android项目的登台服务器 - staging server for google-cloud endpoint app-engine connected android project 应用引擎同时验证Google帐户和Google Plus - App-engine authenticating google account and google plus at the same time 在python应用引擎端点上测试android应用 - Testing android app on python app-engine endpoint 如何将我的数据库连接到我的 android 应用程序 - How can i connect my database to my android app 使用Gmail API和Google App-Engine时的身份验证 - Authentication when using Gmail API and Google App-Engine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM