Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a chat application in android? [closed]

Tags:

android

sdk

chat

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?

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

like image 210
Urvashi Hirani Avatar asked Dec 28 '10 05:12

Urvashi Hirani


People also ask

What is the purpose of chat application?

A chat application makes it easy to communicate with people anywhere in the world by sending and receiving messages in real time. With a chat app, users are able to receive the same engaging and lively interactions through custom messaging features, just as they would in person.


2 Answers

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.

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.

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.

Firebase have a library called GeoFire which allows you to make your apps location aware.

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.

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.

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.

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:

  • 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.

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.

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.

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.

like image 147
James Andrews Avatar answered Sep 29 '22 05:09

James Andrews


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:

Simple Android Map/Chat application: https://quickblox.com/developers/Android_XMPP_Chat_Sample

like image 38
Rubycon Avatar answered Sep 29 '22 04:09

Rubycon