I would like to add chat functionality with online user in gmail in android. how to add chat feature in my own application in android?
我想在android中的gmail中添加聊天功能和在线用户。如何在我自己的Android应用程序中添加聊天功能?
I want to show an online user in google maps which is nearest to the area which I have selected and have the ability to chat with that online user
我想在谷歌地图中显示一个在线用户,该地图最接近我选择的区域,并且能够与该在线用户聊天
10
To add chat to an Android application there are a number of options. I'll present the options ordered by the amount of development expertise that's required - from least to most.
要向Android应用程序添加聊天,有许多选项。我将根据所需的开发专业知识量 - 从最少到最多 - 提供所选择的选项。
Using a real-time backend service
使用实时后端服务
There are a number of companies offering real-time backend services. These services would provide you with an SDK which allows your app to access their servers. Using the SDK you would be able to stream data between devices.
有许多公司提供实时后端服务。这些服务将为您提供一个SDK,允许您的应用访问其服务器。使用SDK,您可以在设备之间传输数据。
Here is a list of the most popular services:
以下是最受欢迎的服务列表:
Firebase
Google owned real-time database which uses WebSockets and MongoDB as it's core technology stack. The service allows you to save data in a no-SQL database and then register to receive real-time updates when that data changes. They also offer services for push notification and file storage. There is also a third party open source messaging framework available for iOS and Android.
谷歌拥有的实时数据库使用WebSockets和MongoDB作为核心技术堆栈。该服务允许您将数据保存在无SQL数据库中,然后注册以在数据更改时接收实时更新。它们还提供推送通知和文件存储服务。还有适用于iOS和Android的第三方开源消息传递框架。
Firebase have a library called GeoFire which allows you to make your apps location aware.
Firebase有一个名为GeoFire的库,可让您识别您的应用位置。
Pusher / PubNub
Pusher / PubNub
I've grouped these together because they are quite similar. They provide real-time streaming infrastructure and technology. You can establish channels between groups of devices and stream data between them. They don't provide any means to authenticate users so you would need an app server.
我把它们组合在一起因为它们非常相似。它们提供实时流媒体基础设施和技术。您可以在设备组之间建立通道,并在它们之间传输数据。他们没有提供任何方法来验证用户,因此您需要一个应用服务器。
Quickblox
Quickblox is targeted specifically at the instant messaging market and they use an XMPP server on the backend. Since they use XMPP, this service has a lot of messaging features built in like privacy lists and typing indicators. They provide a reasonable but basic example messaging app.
Quickblox专门针对即时通讯市场,他们在后端使用XMPP服务器。由于他们使用XMPP,因此该服务具有许多内置的消息功能,如隐私列表和键入指示器。它们提供了一个合理但基本的示例消息应用程
Layer
Layer is half way between Quickblox and PubNub / Pusher. They offer a streaming platform which is targeted towards instant messaging. They have some messaging features like basic blocking but this isn't a full scale messaging implementation like Quickblox. They have a library of UI components that can be used to help build a complete app - Atlas.
Layer位于Quickblox和PubNub / Pusher之间。他们提供了一个针对即时消息的流媒体平台。它们具有一些消息传递功能,如基本阻止,但这不是像Quickblox这样的全面消息传递实现。他们有一个UI组件库,可用于帮助构建完整的应用程序--Atlas。
If you use a backend as a service you will always have to build the chat client yourself. If you go with one of the more general purpose options like Firebase, you will also have to build your own messaging protocol.
如果您使用后端作为服务,您将始终必须自己构建聊天客户端。如果您使用Firebase等更通用的选项之一,则还必须构建自己的消息传递协议。
These services will save you time when it comes to the real-time server implementation, server configuration and scaling.
这些服务将为您节省实时服务器实施,服务器配置和扩展的时间。
XMPP
Another option is to host an XMPP server yourself. There are a number of open source XMPP servers available:
另一种选择是自己托管XMPP服务器。有许多开源XMPP服务器可供使用:
XMPP servers will provide you with a large amount of messaging functionality out of the box. They generally don't include any location awareness but this could be solved by configuring the server to host the user database on a separate server - that would allow you to add extra tables to handle the geolocation. An alternative would be to use presence to update relevant devices when a user's location changed by a certain amount.
XMPP服务器将为您提供开箱即用的大量消息传递功能。它们通常不包括任何位置感知,但这可以通过将服务器配置为在单独的服务器上托管用户数据库来解决 - 这将允许您添加额外的表来处理地理位置。另一种方法是在用户的位置改变一定量时使用在线更新相关设备。
To build the client I would recommend using Smack. Since XMPP is an open standard, your client should be able to work with third party XMPP servers and clients.
为了构建客户端,我建议使用Smack。由于XMPP是开放标准,因此您的客户端应该能够使用第三方XMPP服务器和客户端。
If you don't want to build the client yourself there are a number of open source projects (mostly under copy left licenses) which could act as a starting point. Xabber would be one example but you can find more by searching. Alternatively, you could use this a commercial open source project.
如果您不想自己构建客户端,则可以使用许多开源项目(主要是复制左侧许可证),这些项目可以作为起点。 Xabber就是一个例子,但你可以通过搜索找到更多。或者,您可以使用此商业开源项目。
Building the server yourself
自己构建服务器
The final option is to build the messaging server yourself. This has the benefit that you could add the features you need and keep it reasonably simple. A good approach would be to use Symfony and the WebSocket Bundle for the real-time back end and Android WebSockets for the client. Using this approach you would have a lot of flexibility implementing the geo location functionality.
最后一个选择是自己构建消息传递服务器。这样做的好处是,您可以添加所需的功能并使其保持相当简单。一种好的方法是使用Symfony和WebSocket Bundle作为客户端的实时后端和Android WebSockets。使用这种方法,您可以灵活地实现地理位置功能。
4
I & my team, we are working on Backend as a Service platform called QuickBlox. We have great example how to integrate Map/Chat features to your application:
我和我的团队,我们正在开发名为QuickBlox的Backend作为服务平台。我们有一个很好的例子,如何将Map / Chat功能集成到您的应用程序:
Simple Android Map/Chat application: https://quickblox.com/developers/Android_XMPP_Chat_Sample
简单的Android地图/聊天应用程序:https://quickblox.com/developers/Android_XMPP_Chat_Sample
3
We have been working very closely with the developer community and have developed Applozic Chat SDK which takes just 10 mins for integration. Give it a try: Applozic Sample code with open source sdk is available in Github: https://github.com/AppLozic/Applozic-Android-SDK
我们一直与开发人员社区密切合作,开发了Applozic Chat SDK,只需10分钟即可完成集成。试一试:Applozic Github提供了带开源sdk的示例代码:https://github.com/AppLozic/Applozic-Android-SDK
2
I dont know about the about GMaps but for implementing chat you can try following link Xmpp
我不知道关于GMaps但是为了实现聊天,你可以尝试以下链接Xmpp
0
Adding a chat functionality, you can use Firebase or XMPP.
添加聊天功能,您可以使用Firebase或XMPP。
For choosing the right option you may prefer this https://www.quora.com/Which-protocol-is-better-to-develop-a-chat-web-app-using-Firebase-XMPP-or-HTTP
为了选择正确的选项,您可能更喜欢这个https://www.quora.com/Which-protocol-is-better-to-develop-a-chat-web-app-using-Firebase-XMPP-or-HTTP
OR
If you have strong knowledge of backend technologies, go ahead with your own. And the same time, there is also an instant solution available in the market that helps to integrate the additional functionality more easily.
如果您对后端技术有深入了解,请继续使用自己的技术。同时,市场上还有一种即时解决方案,可以帮助您更轻松地集成其他功能。
0
We provide a real time chat SDK solution called ChatCamp. You would be able to add chat functionality to your Android app quickly with the help of ChatCamp SDK. Here is the link to Android quick start guide - https://docs.chatcamp.io/docs/android-chat-quickstart. Also, it is possible to order the user list based on the distance from a particular location or you may show online users on top of Google Maps.
我们提供名为ChatCamp的实时聊天SDK解决方案。您可以在ChatCamp SDK的帮助下快速为Android应用添加聊天功能。以下是Android快速入门指南的链接 - https://docs.chatcamp.io/docs/android-chat-quickstart。此外,可以根据与特定位置的距离订购用户列表,也可以在Google地图上显示在线用户。