热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何在android中创建聊天应用程序?-Howtomakeachatapplicationinandroid?

Iwouldliketoaddchatfunctionalitywithonlineuseringmailinandroid.howtoaddchatfeature

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

我想在谷歌地图中显示一个在线用户,该地图最接近我选择的区域,并且能够与该在线用户聊天

6 个解决方案

#1


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服务器可供使用:

  • ejabberd
  • Prosody
  • OpenFire

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。使用这种方法,您可以灵活地实现地理位置功能。

#2


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


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

#4


2  

I dont know about the about GMaps but for implementing chat you can try following link Xmpp

我不知道关于GMaps但是为了实现聊天,你可以尝试以下链接Xmpp

#5


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.

如果您对后端技术有深入了解,请继续使用自己的技术。同时,市场上还有一种即时解决方案,可以帮助您更轻松地集成其他功能。

#6


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地图上显示在线用户。


推荐阅读
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 深入解析Spring Cloud Ribbon负载均衡机制
    本文详细介绍了Spring Cloud中的Ribbon组件如何实现服务调用的负载均衡。通过分析其工作原理、源码结构及配置方式,帮助读者理解Ribbon在分布式系统中的重要作用。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • 本文详细记录了在基于Debian的Deepin 20操作系统上安装MySQL 5.7的具体步骤,包括软件包的选择、依赖项的处理及远程访问权限的配置。 ... [详细]
  • Windows服务与数据库交互问题解析
    本文探讨了在Windows 10(64位)环境下开发的Windows服务,旨在定期向本地MS SQL Server (v.11)插入记录。尽管服务已成功安装并运行,但记录并未正确插入。我们将详细分析可能的原因及解决方案。 ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • 使用 Azure Service Principal 和 Microsoft Graph API 获取 AAD 用户列表
    本文介绍了一段通用代码示例,该代码不仅能够操作 Azure Active Directory (AAD),还可以通过 Azure Service Principal 的授权访问和管理 Azure 订阅资源。Azure 的架构可以分为两个层级:AAD 和 Subscription。 ... [详细]
  • UNP 第9章:主机名与地址转换
    本章探讨了用于在主机名和数值地址之间进行转换的函数,如gethostbyname和gethostbyaddr。此外,还介绍了getservbyname和getservbyport函数,用于在服务器名和端口号之间进行转换。 ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 本文详细介绍如何使用Samba软件配置CIFS文件共享服务,涵盖安装、配置、权限管理及多用户挂载等关键步骤。通过具体示例和命令行操作,帮助读者快速搭建并优化Samba服务器。 ... [详细]
  • 使用Vultr云服务器和Namesilo域名搭建个人网站
    本文详细介绍了如何通过Vultr云服务器和Namesilo域名搭建一个功能齐全的个人网站,包括购买、配置服务器以及绑定域名的具体步骤。文章还提供了详细的命令行操作指南,帮助读者顺利完成建站过程。 ... [详细]
  • 本文详细介绍了 Dockerfile 的编写方法及其在网络配置中的应用,涵盖基础指令、镜像构建与发布流程,并深入探讨了 Docker 的默认网络、容器互联及自定义网络的实现。 ... [详细]
author-avatar
super---小杰_360
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有