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


推荐阅读
  • JobScheduler5.0源码分析
    0.JobScheduler执行代码mJobScheduler(JobScheduler)getSystemService(Context.JOB_SCHEDULER_SERVICE); ... [详细]
  • 探讨如何利用Visual Basic (VB) 将十六进制或二进制字符串写入Windows注册表的方法。 ... [详细]
  • 本文通过对OkHttp源码的详细解读,旨在帮助读者理解其核心执行流程,特别是同步与异步请求的处理方式。文中不仅涵盖了基本的使用示例,还深入探讨了OkHttp的核心功能——拦截器链的工作原理。 ... [详细]
  • HTML5 拖拽功能实现
    本文通过一个简单的示例,展示了如何利用 HTML5 的拖放 API 实现元素之间的拖拽功能。示例包括 HTML 结构、CSS 样式以及 JavaScript 逻辑,旨在帮助开发者快速理解和应用拖拽技术。 ... [详细]
  • Windows 系统中 Flutter 与 IntelliJ IDEA 的环境配置指南
    本指南详细介绍了如何在 Windows 操作系统上设置 Flutter 开发环境,并集成至 IntelliJ IDEA 中,适合初学者及专业人士参考。 ... [详细]
  • Sass 是一种 CSS 的预处理器,通过使用变量、嵌套、继承等高级功能,使得 CSS 的编写更加灵活和高效。本文将介绍 Sass 的基本语法及其安装使用方法。 ... [详细]
  • 本文详细介绍了如何利用go-zero框架从需求分析到最终部署至Kubernetes的全过程,特别聚焦于微服务架构中的网关设计与实现。项目采用了go-zero及其生态组件,涵盖了从API设计到RPC调用,再到生产环境下的监控与维护等多方面内容。 ... [详细]
  • Android开发经验分享:优化用户体验的关键因素
    随着Android市场的不断扩展,用户对于移动应用的期望也在不断提高。本文探讨了在Android开发中如何优化用户体验,以及为何用户体验的重要性超过了技术本身。 ... [详细]
  • 本文详细探讨了在Python开发中遇到的ImportError: 无法找到名为Crypto.Cipher的模块的问题,并提供了多种解决方案,包括环境配置、库安装和代码调整等方法。 ... [详细]
  • 探讨在C# ASP.NET环境下,如何将一个Div元素居中显示于表单中,同时解决标签文本断行的问题。 ... [详细]
  • 本文探讨了在Vue项目中使用BetterScroll时,由于网络请求慢导致滚动区域无法正常滑动的原因及解决方案。重点介绍了通过监听图片加载事件并调用refresh方法来解决这一问题的方法。 ... [详细]
  • 本文探讨了在JavaScript中如何有效地从服务器控件DropDownList中获取绑定的ID值,而非仅仅是显示的文本值。这对于需要根据用户选择动态处理数据的应用场景非常有用。 ... [详细]
  • 2023年PHP处理请求超时的全面指南
    本文详细介绍了在PHP中处理请求超时的各种方法,包括设置脚本执行时间、处理file_get_contents函数超时以及优化AJAX请求等,适合开发者参考学习。 ... [详细]
  • 本文提供了详细的指导,帮助开发者了解如何使用PHP插件进行网站内容的翻译,特别是针对WordPress插件和主题的汉化及多语言支持。 ... [详细]
  • 探讨了使用 JavaScript IIFE(立即执行函数表达式)动态加载 YouTube 脚本时遇到的问题,并提供了可能的解决方案。 ... [详细]
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社区 版权所有