Android 将数据发送回服务器
如何从 Android 应用程序将数据发送回服务器?
我已经尝试使用 HttpPost 并发布回 RESTful WCF 服务,但我无法让它工作(我已经创建了一个关于此的问题,但没有找到解决方案..) - 无论我做什么,我都会保留得到 405 Method not allowed 或 400 Bad Request.. :(
我不一定要求完整的代码示例.. 只是一个方向指针,它可以使我将数据发送回服务器。
重要的是用户不应该有允许或拒绝转移..可以说,它应该在幕后发生
提前致谢
How would one go about sending data back to server, from an android application?
I've already tried using HttpPost and posted back to a RESTful WCF service, but I couldnt get that to work (I've already created a SO question about this, without finding the solution..) - No matter what I do I keep getting 405 Method not allowed or the 400 Bad Request.. :(
I'm not asking for full code example necessarily.. just a pointer in a direction, which can enable me to send data back to a server.
It is important that the user should not have to allow or dismiss the transfer.. it should happen under the covers, so to speak
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
服务是出路。 REST(我在 Android 上推荐这个),或者基于 SOAP。有大量关于让 Android 应用程序与服务进行通信的教程,甚至使用 .net / wcf 的教程也是如此。
不过,您始终可以打开原始套接字并使用某些自定义协议发送数据。
编辑:
这是我的 asynctask 处理 http post 通信的 doInBackground 部分,也许会有帮助:
Services is the way to go. REST (I recommend this one on Android), or SOAP based. There're loads of tutorials on getting an android app communicate a service, even with .net / wcf ones.
Tho you can always just open raw sockets and send data with some custom protocol.
Edit:
Here's the doInBackground part of my asynctask handling http post communication, maybe that'll help: