学习即时通讯协议XMPP的基础知识,协议通信的原理。再使用Android Studio进行客户端的开发,再配合openfire服务器的使用,最终实现了本系统的核心功能实时聊天。
摘要:如今的移动设备、便携式设备是多功能的,我们在手机上安装了各式各样的应用程序,这些移动应用程序给我们带来很多的便利,通过这些应用我们就可以足不出户知天下。其中,我们使用得最为频繁的当属IM(InstantMessaging),即时通讯的应用软件,它可以让我们随时随地、轻松方便的联系朋友、同事以及家人,这也让它成为了互联网中主要的通讯方式之一。
本文主要介绍的内容是:在安卓平台下,实现一个即时通讯应用程序的过程,在AndroidStudio工具环境下使用Java语言来实现客户端的设计,通过分析XMPP协议,采用了开源的Openfire服务器作为本次开发的服务端。服务端作为一个中转站,接收客户端发送的请求,经过处理后转发给客户端相应的响应信息,把响应结果反馈到客户端的UI显示层。
本即时通讯系统从需求分析设计,直到程序最后的实现调试都是基于软件工程的开发步骤进行的,最后实现了用户申请账号,修改个人信息,实时聊天,语音发送,群组聊天等功能,在开发过程中,遇到了不少困难,但也总结了很多关于安卓应用的开发经验。
关键词:即时通讯;XMPP;安卓
Abstract:Nowadays, mobile devices and portable devices are multi-functional. A number of applications are installed on our phones, which brings us a lot of convenience. We can find out everything that happened in this world without getting out, but with a mobile device. Among all these applications, the most frequently used app is IM, which gives us an easy way to keep in touch with our friends, colleagues, and family anytime and anywhere.Thus, IM has become one of the major ways of communication on the Internet.
This essay mainly introduce about the development of designing a IM application based on Android platform. The client was designed with Java language in the Android Studio. The Openfire server was chosen to be the server of this experiment after the analysis of XMPP protocol. The server serves as a transfer station. It receives all the requests sent by the client and transmits the corresponding response messages to the client after processing. Eventually, the response feedback will be displayed on the client’s UI layer.
In this instant messaging system, the whole design process is based on the steps of software engineering development. Finally, users can access to the system and modify personal information. Also, you can have real-time chat with your friends, including voice chat and multiuser chat. During the process, I encountered some diffculties, overcame them and learned so much about Android development.
Keywords: Instant Messaging; XMPP; Android
目录
第一章绪论 1
1.1课题背景 1
1.2国内外现状 1
1.3研究目的及意义 2
第二章相关技术介绍 3
2.1安卓系统介绍 3
2.1.1安卓系统架构 3
2.1.2安卓的四大组件 4
2.1.3AndroidFragment 5
2.2XMPP协议 7
2.2.1Jabber协议 7
2.2.2XMPP体系架构 7
2.2.3XMPP地址格式 8
2.2.4XML流 9
2.2.5XMLStanza 9
2.3本章小结 11
第三章可行性研究与需求分析 12
3.1可行性研究 12
3.1.1技术可行性 12
3.1.2经济可行性 12
3.2需求分析 12
3.2.1系统用例分析 13
3.2.2系统功能需求 13
3.2.3非功能需求 14
第四章系统设计 15
4.1系统的数据库设计 15
4.1.1服务端数据库 15
4.1.2客户端数据库 17
4.2系统功能原理 19
4.2.1服务器处理消息 19
4.2.2客户端处理消息 21
4.3系统的功能设计 22
4.3.1用户注册功能模块设计 22
4.3.2用户登录功能模块设计 23
4.3.3添加好友功能模块设计 24
4.3.4删除好友功能模块设计 25
4.3.5发送信息功能模块设计 26
4.3.6接收好友信息功能模块设计 27