Our term project application mainly focuses on educational purpose. In order to learn Android programming using Java language we implemented open-source chatting program for Android operating system.
The main function of chat application is sending/receiving messages in realtime. To deliver messages in realtime, Firebase Realtime Database was used. It allows to listen to any changes occuring in database which is very helpful in Messenger. You can also send pictures from Gallery written in Kotlin. It contains lots of beautiful images. In search field, type appropriate keyword and plenty of images related to your query will be provided.
Below are the implementation details containing information about application functions and database implementations.
We created user-friendly GUI, where it is not complicated to intuitively use chatting and contact search. This is the final version of UI. UI implementation is free of third-party APIs and libraries like Scaledrone or Bootstrap. Every UI component is coded in XML files and only native Android Studio tools were used for this purpose.
First and foremost, a user must sign in to use our chat app. If you do not have an account yet, press on image button on the right of the form to create a new account.
If all required fields are filled and are valid, a new account entry is created in Firebase Authentication mechanism.
It looks like:
Next, to sign in, enter your email address and password.
After singing in, user may add a person to chat with. To do this, enter valid email address of registered user into search field and tap on mangifier icon. If account is valid and does exist in database, a new recycler view entry will be created with full name and email address displayed on it.
Basically, message exchange in realtime is constantly pushing information into database and fetching from it. For example, if current user sends some message, a new message entry is created in database and then is read by Firebase asynchronous listeners. In UI, messages of current user are displayed green and attached to the right side of the window, while messages of a peer are displayed from the left and are in blue color respectively.
You cannot send your pictures from gallery in our application, instead, we implemented online gallery with plenty of beautiful pictures. To share some thematic image, type keywords related to the picture in search field.
This is how it looks in chat:
For this image I typed 'hockey' in Gallery:
We used Firebase Realtime Database to handle authentication purpose. The identifiers are user email address and password. Whenever a new account is created, user ID is generated by Firebase push() function. It is based on current timestamp.
These UIDs are needed in order to connect people who are talking to each other. The logic is as follows: in database each chat is represented as one-to-one relationship concatenating UIDs of two chat members. So, chat ID itself is a unique identifier representing a single message container but on the other hand, it is just a string concatenating UIDs of this chat members. To keep in mind that some chat already exists with messages attached to it, whenever a new chat is created, we need to check if a chat contains current user ID.
Message entry in database contains following fields:
- message ID //unique message identifier
- sender ID //to know which user among two sent message
- sender email
- recipient email
- content //content of message
- timestamp //date and time when sent
- type //can be text, image or link
- url //none if text










