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.waleska404.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.
Support it by joining stargazers for this repository. ⭐
And follow me for my next creations! 🤓
MIT License
Copyright (c) 2023 Paula Boyano Ivars
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.