# MZAP--Mobile Application for Basketball Match Tracking and Digitalization of Endgame Reports
## 4 MZAP Android Application--Appearance and Usage
### Loading Match Records (Online and Offline)  
During use, MZAP automatically saves match record data to the application's Shared Preferences and allows exporting it as a.zap file to internal storage or an SD card via the Save option in the Main menu. Each record is assigned a unique UUID, which is used in the default file naming convention, though naming based on data from the Match Fragment is also supported.  
When the user selects the Open Record (Offline) menu item, the Open Record Dialog (Figure 19) appears. This dialog acts as a custom file browser, showing only files with the.zap extension. Upon selecting a match record and confirming the dialog, the current match record in the application's Shared Preferences is replaced by the selected record, which is then loaded and displayed.  
When the user selects the Open Record (Online) menu item, the Open Record (Online) Dialog, shown in Figure 20, is displayed. This dialog features two spinners: one to display available leagues and another to display the basketball matches associated with the selected league.  
Figure 19: Open Record Dialog (offline).  
Figure 20: Open Record Dialog (online).  
First, a list of leagues is loaded into the league spinner. Upon selecting a league, the list of matches associated with that league is displayed in the matches spinner below. If a user selects a match from this spinner and confirms the dialog, the current match record is discarded, and a new match record is generated based on information retrieved from the RESTful API server. It is important to note that this option does not load a complete match record from the online source; instead, it loads all available information regarding the match, players, referees, and other officials to prepare the MZAP application for match tracking. If the match record is not loaded from an online source, it must be manually created, which is time-consuming. Therefore, loading match data from an online source is the preferred option when using the MZAP application.  
Data synchronization and consistency checks are performed when match reports are transmitted to the RESTful API server. There are two types of match records: those initiated on the MZAP Android application and those initiated on the RESTful API server. The primary distinction between these types lies in which application is responsible for generating the identifiers associated with match report entities.  
When a match record is created on the MZAP Android application, both the match UUID and player identifiers are generated locally. These locally generated identifiers must be validated for inconsistencies upon transmission to the RESTful API server. Based on the match endgame data, a corresponding match record is created on the server. In this process, the server adopts the match UUID provided by the MZAP Android application and, using the received identifiers, attempts to resolve references to players, referees, coaches, and other officials. This ensures that the data is accurately stored in a relational database and that a valid copy of the match report is maintained through the insertion of scoreboard data.  
Conversely, when a match record is retrieved from the RESTful API server, the MZAP Android application adopts the predefined match UUID and player identifiers to maintain consistency during subsequent data transmission back to the server. When this type of match record is received by the RESTful API server, it undergoes the same validation procedures as those applied to records initially created on the Android application.  
At present, integration with existing league management systems is not prioritized. However, should such a requirement arise, integration would be implemented through designated RESTful API endpoints.