The purpose of this document is to clearly define the functionality of the application developed as part of this course project. The aim is to implement one of the European Union's priorities: sustainability and resource saving. The app allows users to dispose of recyclable items and receive rewards through a point system.
The functions of the application are as follows:
- R1: Mechanism for login/registration.
- R2: User profile with statistics/progress bar towards the next reward.
- R3: Form for recording the type of materials disposed of in the bin.
- R1: Approval of records and automatic allocation of points for rewards.
- R2: Viewing top statistics.
- R(2++): Form for configuring rewards based on material/amount recycled.
The developed system is not standalone but interacts with other software systems. In addition to the under-development product described in section 1.2, it includes:
- The mobile application: Each user has the application downloaded on their mobile device, allowing them to perform the aforementioned actions to recycle products.
- The server (backend) between the application and the database implemented with Spring Boot for API calls.
- The database with some predefined values for demonstration purposes.
- The system requires Java 17 or higher and Android Studio Flamingo | 2022.2.1 or higher.
- The system requires Android Gradle Version 8.0 and Minimum SDK Version 24 (API 24: Android 7.0 Nougat).
- The system requires a database. To store the database and for simplicity reasons, we used XAMPP, which has a pre-installed MySQL server that is also pre-configured. If you do not want to use XAMPP, you can set up your own MySQL server locally and run the application.
- The network interface of the application to the server is done locally using the iPv4 address. The file where it can be specified for each computer is located in the Frontend with the name Strings.xml and iPv4 property name.
- Each user is identified via a username and password.
- For simplicity, no security policies were used regarding user identification.
- The application administrator is predefined and no more than one can be created without programming intervention.
MySQL is used to store the application data in 4 tables: users, recycle_items, recycle_requests, and request_list_items. The server interacts with the database via Jakarta Persistence API (JPA), which uses class objects for database communication. Each class object corresponds to a row in the respective relational table, and each object property corresponds to a column in the relational table.
The files used and created are as follows:
- Backend Folder: Contains the implemented code in Spring Boot,
schema.sqlanddata.sqlfiles for database schema description and initialization, aninitialScriptForDB.sqlfile for database creation in XAMPP, and anapplication.propertiesfile that provides database connection details. - Frontend Folder: Contains the implemented code in Java for Android Studio along with all necessary files, images, fonts, etc.
Classes are divided into 4 packages: Activities, Adapters, HttpRequests, and Model.
-
Folder - Activities
LoginActivity: Initial screen at application launch responsible for entering user details or transitioning to the Registration screen if the user is new.RegistrationActivity: Registration screen responsible for entering user details.AdminOpenRequestsActivity: Screen where the administrator sees open requests and approves or rejects them accordingly.RecycleActivity: Screen responsible for selecting recyclable materials, their quantity, and sending them.StatisticsActivity: Screen showing the top 3 users with the highest recorded points.UpdateRecycleItemPointsActivity: Screen where the administrator can modify the reward points for each recyclable item.YourRewardsActivity: Screen responsible for displaying user points and a progress bar showing the user's progress towards the next level.
-
Folder - HttpRequests
- Contains all classes handling data from each activity and making GET or POST API calls to the server as needed.
-
Folder - Model
OpenRequestDetailsRecycleItemRecycleListItem
These classes are designed based on specific design patterns to intercommunicate between other classes, allowing the exchange of data and the storage of information for the different objects.
-
Folder - Adapters
OpenRequestBodyListAdapterOpenRequestExpandableListViewAdapterRecycleItemsAdapterRequestListItemAdapter
These classes are designed to bridge the gap between a Display/Activity and its class and relates to elements of the UI that displays that data.
Classes are divided into 4 packages: Controllers, Model, Repositories, and Services.
-
Folder - Controllers
RequestsController: Responsible for handling all requests to the server, calling the corresponding service for each request.
-
Folder - Model
LoginRequest: Login details (username, password) are converted to an object of this class for checking if the user exists in the database.RecycleItem: Represents recyclable items and corresponds to therecycle_itemstable.RecycleRequest: User's request for reward points is converted to an object of this class for database storage, corresponding to therecycle_requeststable.RecycleRequestDTO: Data Transfer Object class forRecycleRequest, used for displaying data in the frontend.RecycleRequestListItem: Represents items included in the user's request, corresponding to therequest_list_itemstable.RecycleRequestListItemDTO: Data Transfer Object class forRecycleRequestListItem.User: Corresponds to theuserstable.UserDTO: Data Transfer Object class forUser.
-
Folder - Repositories
RecycleItemsRepository: Used by JPA for storingRecycleItemsobjects.RecycleRequestListItemsRepository: Repository forRecycleRequestListItemobjects.RecycleRequestsRepository: Repository forRecycleRequestobjects.UsersRepository: Repository forUserobjects.- Note: These are interfaces extending
JpaRepository, with methods implemented automatically by JPA.
-
Folder - Services
RecycleItemsService: Contains aRecycleItemsRepositoryobject to communicate with the database, providing methods accessible byRequestsController.RecycleRequestListItemsService: Contains aRecycleRequestListItemsRepositoryobject, with methods called byRequestsController.RecycleRequestsService: Service for handlingRecycleRequestobjects.UserService: Service for handlingUserobjects.
Note: There is also a BackendRclApplication class that serves as the server's entry point, as well as a DatabaseInitializer class which is responsible for initializing the database by executing schema.sql and data.sql.
The application can be executed within Android Studio using the standard run functionality.
- XAMPP Control Panel with Apache and MySQL servers installed and functional.
initialScriptForDB.sqllocated within the project's backend folder.
-
Start Apache and MySQL Servers: Launch the XAMPP Control Panel and activate both Apache and MySQL servers using the respective "Start" buttons.
-
Access phpMyAdmin: Apache must be running to access the phpMyAdmin administration panel. Utilize the "Admin" button corresponding to the MySQL server to open the phpMyAdmin interface in your web browser.
-
Import Initial Script:
- Within phpMyAdmin, navigate to the "Import" section.
- Select the "Choose File" option and locate the
initialScriptForDB.sqlfile within the project's backend folder. - Initiate the import process using the "Go" button. (This step is only required for the first-time server execution.)
-
Open Terminal in Backend Folder: Access the project's backend directory using a terminal window.
-
Run Server Command: Execute the following command within the terminal:
java -jar backend_rcl.jar
Ensure both Apache and MySQL servers are operational before running the server command. Failure to do so will prevent the backend server from establishing a database connection.
- Github: Recycling Reward App Repository
- YouTube: RCL-App Demo







