A Tic Tac Toe game Android app for playing in real time with two devices. Using Firebase, Compose and Hilt based on modern Android tech-stack and MVVM architecture.
- 100% Kotlin based + Coroutines + Flow for asynchronous.
- Hilt for dependency injection.
- Firebase: Realtime database.
- JetPack
- Compose - A modern toolkit for building native Android UI.
- Lifecycle - dispose observing data when lifecycle state changes.
- ViewModel - UI related data holder, lifecycle aware.
- Architecture
- Clean Architecture.
- MVVM Architecture (Declarative View - ViewModel - Model)
- Material Design & Animations.
- Create game and copy the game ID to share it.
- Join a game with the game ID.
- Play the game.
- Game history.
For security reasons, I have not added the google-services.json
file. This file is responsible for establishing the connection to the Firebase database. Here, I will explain how you can set up own Firebase Realtime database for FREE, download google-services.json
and how to use it. This is necessary if you want to download and build this Android project.
-
Login to firebase console and add a new project.
-
Give a name to the Firebase project.
-
If you want you can enable Google Analytics. Click
Continue
. -
If you enabled Google Analytics select your preferred Google Analytics account and click
Create project
. -
Wait until your project is ready and click
Continue
. -
On your new Firebase project main screen click the Android icon to add Firebase to your Android app.
-
Register the app:
โ ๏ธ Make sure to specifycom.ft.tictactoe
as the package name.โ ๏ธ - Optionally enter the nickname for the app.
- Click
Register app
.
-
โ ๏ธ DO NOT DOWNLOAD THE JSON FILE YET.โ ๏ธ Just click continue, it will be downloaded later when all the config is set up. -
The Firebase SDK is already added in this project. You can check if everything is fine just in case. Click
Next
. -
Click
Continue to the console
. -
On the main page of the Firebase project go to
Build > Realtime Database
. -
On Realtime Database page click
Create Database
. -
Choose your prefrerred location for the database and click
Next
. -
Choose any option for the security rules and click
Enable
, we will edit this rules later. -
Go to Rules tab and edit them specifying the following rules: Then click on
Publish
.{ "rules": { ".read": true, ".write": true } }
-
Finally, go to
Project settings
and download thegoogle-services.json
file. -
Last step: Add the downloaded file to your Android project under
TicTacToe > app > src
and build the project.