On this page

Fishook

Overview

Fishook is a mobile application that utilizes the Maps SDK to track users’ fishing locations and assign points accordingly. We also incorporated a database to hold the fish information for both the user profile and leaderboard. Fishes will populate your profile once added to the app. Points are assigned to users based on the fish’s length and weight.

Requirements

This application was built using Kotlin in Android Studio, and it requires these dependencies to run the Maps SDK and the Room database, respectively:

dependencies {
    // Google Maps
    implementation("com.google.android.gms:play-services-maps:18.2.0")
    implementation("com.google.maps.android:maps-compose:2.11.4")

    // Room
    implementation("androidx.room:room-runtime:2.6.1")
    implementation("androidx.room:room-ktx:2.6.1")
    kapt("androidx.room:room-compiler:2.6.1")
}

We use an Android Room database to store the user’s information.

Getting Started

This guide explains how to clone, run, and modify the app in Android Studio.

1. Requirements

2. Clone the Project

git clone https://github.com/nazimja4arov/Fishing-Android-App.git
cd Fishing-Android-App

3. Open in Android Studio

4. Editing the Code

Project Structure

Screens

Home Screen

Screenshot: View Screenshot

The main screen of the app. You are able to click on different points of the map to see different fishing locations. From here, you can also navigate to all of the other screens of the application.

To use the Maps SDK, you will need to do the following tutorial from the Google Maps Platform for Maps SDK and create an API key through the Google Maps Platform in Google Cloud:

https://developers.google.com/maps/documentation/android-sdk/config

To find additional information about setting up Maps SDK, navigate to the See Also Section.

We created our own color scheme for the background using set values to create a hue. If you want to change the overall color of the app, you can change these values to reflect different colors:

transparentLightBlue: Color = Color(red = 0f, green = 0.5f, blue = 1f, alpha = 0.25f)
LightBlue: Color = Color(red = 0f, green = 0.5f, blue = 1f, alpha = 0.75f)

If you would like to add new users to the app, currently you must add a new user through the seedData() function within the app:

private fun seedData() {
    users = users + ("Guest" to UserDataClass("Guest", R.drawable.app_pfp, "Guest User", basePoints))
    users = users + ("TARA" to UserDataClass("Tara", R.drawable.app_pfp, "Tara Barnett", 80))
    users = users + ("ZEKE" to UserDataClass("Zeke", R.drawable.app_pfp, "Zeke Turnbough", 120))
    users = users + ("NAZIM" to UserDataClass("Nazim", R.drawable.app_pfp, "Nazim Jafarov", 90))
}

Add Fish Screen

Screenshot: View Screenshot

This screen is used once the user is logged in to add a fish to their collection. Users must input the fish’s name (or general description of the fish if they aren’t familiar with it), the fish’s length (in inches), and the fish’s weight (in pounds). Users can add an image from their gallery to use for their fish; however, if they don’t wish to or don’t have a picture of their catch, a default image will be used.

Once the fields have been filled correctly, the fish and all of its data will be added to the list of the user’s catches. Fish are defined as a data class following this format:

data class FishDataClass(
    val userName: String,
    val fishName: String,
    val fishImage: String?,
    val fishLength: Int,
    val fishWeight: Int
)

And fish are added to a user’s profile with this code:

fun addFish(name: String, image: String?, length: Int, weight: Int) {
    val img = image ?: defaultImage
    val newEntry = FishDataClass(
        userName = currentUserId,
        fishName = name,
        fishImage = img,
        fishLength = length,
        fishWeight = weight
    )

    val updatedList = getCurrentUserFish() + newEntry
    fish = fish + (currentUserId to updatedList)

    val user = getCurrentUser()
    if (user != null) {
        val newPoints = user.userPoints + length + weight * 2
        users = users + (currentUserId to user.copy(userPoints = newPoints))
    }
    viewModelScope.launch {
        repo.saveFish(
            FishEntity(
                userId = currentUserId,
                name = name,
                length = length,
                weight = weight,
                image = img
            )
        )
    }
}

User Profile Screen

Screenshot: View Screenshot

This is where users can view their profile and their stats. Your name, profile picture, points, and catches are all visible on the page. Users are defined as a data class following this format:

data class UserDataClass(
    val userName: String,
    val userProfilePicture: Int,
    val userFullName: String,
    val userPoints: Int
)

Leaderboard Screen

Screenshot: View Screenshot

This screen displays the top scorers who use the app, listed in descending order for simplicity. To get onto the leaderboard, you have to catch a fish, click the add fish button, put in the details, and watch your score go up!

This screen takes in the user view model to pull in the player stats information for the leaderboard. It also calls the Fish repository, which stores the information for what fish are added to your profile. This also updates the total points for the user based on the fish in the database.

If you want to change how points are calculated, you would change the calculation for the newPoints variable in this code snippet:

val user = getCurrentUser()
if (user != null) {
    val newPoints = user.userPoints + length + weight * 2
    users = users + (currentUserId to user.copy(userPoints = newPoints))
}

Conclusions

Overall, Fishook is a great app that can not only be used to get outdoors but also to connect people locally (and hopefully in the future globally)! For future updates to Fishook, we would like to sync the map location with the Add Fish screen, so that the location information gets saved to the fish repository and user profile. Another future update would include implementing Firebase for users to log in. We’ve learned so much over the past semester and want to say thank you to everyone for a good semester.

See Also Section

We used a couple of videos to help us with implementing Google Maps SDK. One was from Code Heroes on YouTube to help us when implementing our maps tool into the application:

https://www.youtube.com/watch?v=QVCNTPNy-vs

Another was a video on how to restrict API keys for the SDK:

https://www.youtube.com/watch?v=2_HZObVbe-g