简体   繁体   English

Android位置感知聊天应用程序

[英]Android location aware chat application

I need help with this kind of application.I don't know how will two devices communicate over internet. 我需要这种应用程序的帮助。我不知道两个设备将如何通过互联网进行通信。 I think I should create database to store users information, and then create sockets for communication. 我想我应该创建数据库来存储用户信息,然后创建用于通信的套接字。 Is there a better way to do this? 有一个更好的方法吗?

  1. Most mobile networks use some form of NAT, so inbound connections to mobile devices are not possible. 大多数移动网络使用某种形式的NAT,因此无法与移动设备建立入站连接。 You'll need an intermediate server. 你需要一个中间服务器。 P2P is possible, but to setup a connection you still need a server. P2P是可能的,但是要建立连接,您仍然需要服务器。

  2. Don't reinvent the wheel: there is already a lot of servers/libraries/protocols that do chat. 不要重新发明轮子:已经有很多服务器/库/协议可以聊天。 Just pick one. 选择一个。 Most notable one is XMPP, with open protocol, multiple free OSS server implementations and libraries (including Android). 最值得注意的是XMPP,具有开放协议,多个免费OSS服务器实现和库(包括Android)。

  3. Additionally you can create your own server app, that does login/authentication and location-aware stuff. 此外,您可以创建自己的服务器应用程序,它可以执行登录/身份验证和位置感知功能。 Once two users are authenticated and location-paired, you can hand-off the chat part to XMPP server. 一旦两个用户通过身份验证和位置配对,您就可以将聊天部件移交给XMPP服务器。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM