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


推荐阅读
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 本文介绍如何在 Android 中通过代码模拟用户的点击和滑动操作,包括参数说明、事件生成及处理逻辑。详细解析了视图(View)对象、坐标偏移量以及不同类型的滑动方式。 ... [详细]
  • 深入解析Android自定义View面试题
    本文探讨了Android Launcher开发中自定义View的重要性,并通过一道经典的面试题,帮助开发者更好地理解自定义View的实现细节。文章不仅涵盖了基础知识,还提供了实际操作建议。 ... [详细]
  • 本文详细介绍 Go+ 编程语言中的上下文处理机制,涵盖其基本概念、关键方法及应用场景。Go+ 是一门结合了 Go 的高效工程开发特性和 Python 数据科学功能的编程语言。 ... [详细]
  • 本文详细介绍了 GWT 中 PopupPanel 类的 onKeyDownPreview 方法,提供了多个代码示例及应用场景,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 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. ... [详细]
  • 技术分享:从动态网站提取站点密钥的解决方案
    本文探讨了如何从动态网站中提取站点密钥,特别是针对验证码(reCAPTCHA)的处理方法。通过结合Selenium和requests库,提供了详细的代码示例和优化建议。 ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 本文基于刘洪波老师的《英文词根词缀精讲》,深入探讨了多个重要词根词缀的起源及其相关词汇,帮助读者更好地理解和记忆英语单词。 ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • IneedtofocusTextCellsonebyoneviaabuttonclick.ItriedlistView.ScrollTo.我需要通过点击按钮逐个关注Tex ... [详细]
  • 本文深入探讨 MyBatis 中动态 SQL 的使用方法,包括 if/where、trim 自定义字符串截取规则、choose 分支选择、封装查询和修改条件的 where/set 标签、批量处理的 foreach 标签以及内置参数和 bind 的用法。 ... [详细]
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
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社区 版权所有