Background Services
UploaderFormService:
The UploaderForms Service is a background service responsible for uploading saved forms to the server. It is triggered automatically by the network change receiver whenever network connectivity is restored, ensuring seamless data synchronization.
Key Responsibilities:
-
Automatic Triggering:
- The service starts when a network connection is detected, allowing previously saved forms to be uploaded.
-
Form Processing and Categorization:
- Retrieves saved forms from local storage or database.
- Identifies specific form types, such as child birth registry forms, and prioritizes them accordingly.
- Ensures forms are structured and processed efficiently before upload.
-
Background Uploading:
- Uploads forms in the background without interrupting the user experience.
- Ensures smooth and efficient synchronization with the server.
-
Error Handling & Resilience:
- Handles network failures or data inconsistencies gracefully.
- Prevents duplicate uploads and ensures failed uploads are retried when the network is available.
-
User Notification & Service Management:
- Creates notifications to inform users about ongoing uploads if necessary.
- Stops the service once all forms are successfully uploaded or if an unrecoverable error occurs.
This UploaderForms Service ensures reliable form data synchronization by automatically handling uploads in the background while optimizing performance and maintaining app stability.
SyncMetadataService:
The SyncMetadataService is a background service that ensures the application’s metadata remains up to date. This service is triggered automatically after every successful user login and performs a check to determine whether the metadata synchronization has already been executed on the same date.
Key Responsibilities:
-
Automatic Triggering:
- The service starts running in the background after every user login.
-
Daily Sync Check:
- It verifies whether the metadata synchronization has already been performed on the same date.
- If the metadata sync has already been completed on the current day, the service does not run again to avoid unnecessary operations.
-
Metadata Update Execution:
- If metadata has not been synced for the current date, the service triggers the synchronization process.
- This ensures that the app always has the latest metadata required for its functionality.
-
Background Operation:
- Runs in the background without affecting the user experience.
- Ensures smooth app performance while keeping metadata updated efficiently.
-
Efficient Resource Utilization:
- Prevents redundant sync operations to optimize network usage and improve app performance.
This MetaData Sync Service plays a crucial role in maintaining application consistency by ensuring that metadata updates occur efficiently while avoiding unnecessary processing.