Basically listener.GetContext(); blocks until an HTTP request is received. You can then use request = context.Request to retrive the HTTP request data and process it. You can then use context.Response to return a response.
You can build an android app that uses web technologies: HTML, CSS, Javascript - essentially it'd be like showing a web page but you envelope it with an app. Then you can run with the idea of serving data to it on the network from your PC, but don't need to really use the Android SDK and Java.
发布评论
评论(3)
我使用 C# HttpListener 如下...
基本上
listener.GetContext();
会阻塞,直到收到 HTTP 请求。然后,您可以使用request = context.Request
检索 HTTP 请求数据并对其进行处理。然后,您可以使用context.Response
返回响应。实施和适应相当简单。
I use a C# HttpListener as follows...
Basically
listener.GetContext();
blocks until an HTTP request is received. You can then userequest = context.Request
to retrive the HTTP request data and process it. You can then usecontext.Response
to return a response.Fairly simple to implement and adapt.
您可以在桌面上自行托管 WCF 服务(即,将其托管在您的应用程序中,而不是通过 IIS)。这相对容易做到。
http://msdn.microsoft.com/en-us/library/ms731758.aspx
只需设置您的 WCF 服务即可返回 XML、JSON,无论您想要什么;然后从“droid”设备上点击它。
You can self-host a WCF service service on the desktop (that is, host it within your application rather than through IIS). It's relatively easy to do.
http://msdn.microsoft.com/en-us/library/ms731758.aspx
Just set up your WCF service to return XML, JSON, whatever you want; and then hit it from the 'droid device.
您可以构建一个使用 Web 技术的 Android 应用程序:HTML、CSS、Javascript - 本质上它就像显示一个网页,但您用一个应用程序将其封装起来。然后,您可以运行从 PC 上通过网络向其提供数据的想法,但不需要真正使用 Android SDK 和 Java。
奥莱利(O'Reilly)有一本关于这个主题的好书:
使用 HTML、CSS 和 JavaScript 构建 Android 应用。看起来甚至可以免费在线访问。
You can build an android app that uses web technologies: HTML, CSS, Javascript - essentially it'd be like showing a web page but you envelope it with an app. Then you can run with the idea of serving data to it on the network from your PC, but don't need to really use the Android SDK and Java.
There's a good O'Reilly book on the subject:
Building Android Apps with HTML, CSS, and JavaScript. Looks like it's even freely accessible online.