The primary goal of the FamilyDocs app is to provide a lifelong, cost-effective platform for family members to keep their documents and data safe and accessible. To ensure the sustainability of providing free or low-cost access, we decided against building our own cloud infrastructure, which could be costly and complex to maintain. Instead, we have leveraged Google's reliable and economical G Suite services. This approach not only guarantees the longevity and security of the app but also keeps operational costs low.
Moreover, the app's architecture is intentionally designed to be open, encouraging other developers to build additional functionalities within this framework. This aspect ensures that the FamilyDocs app can evolve through contributions from various developers, enhancing its capabilities over time. Importantly, all data generated by the app is securely stored and accessible in users' Google Drive accounts, ensuring that it remains safe and can be accessed at any time.
Upon first use, users sign into the FamilyDocs app using their Gmail account. The app then requests permission to access the user's Google Drive. Once permission is granted, FamilyDocs creates a dedicated folder within Google Drive, named "FamilyDocs," to securely store and back up all user data and documents added to the application.
Inside the FamilyDocs folder in Google Drive, the app creates a Google Sheet which acts as a database. This sheet is used to track details about the files, users, and other relevant data, ensuring that everything is organized and easily accessible.
Documents added to the FamilyDocs app are immediately uploaded to the Google Drive "FamilyDocs" folder. For each document uploaded, the app also creates an additional file with the same name but with a ".fmly" extension. This file contains a JSON object that holds all relevant information about the document. FamilyDocs app uses GUIDs (Globally Unique Identifiers) for all objects to ensure uniqueness across different app instances.
When a document is shared among family members, both the original file and its corresponding ".fmly" file are shared with the Gmail accounts of the designated family members. Additionally, FamilyDocs sends a Firebase message to the FamilyDocs app instances of those family members. This message triggers the apps to look for the newly shared files in their Google Drive, specifically for files with the ".fmly" extension.
Upon receiving a Firebase notification, the targeted FamilyDocs app instances search their Google Drive for the shared files. They parse the JSON data in the ".fmly" files and download the original documents into their local storage. This process ensures that shared files appear instantly in family members' apps, fully synchronized and accessible.
How Restore Works
The restore function in the FamilyDocs app is a critical feature that allows users to seamlessly transfer their app's state to a new device or maintain consistent settings and data across multiple devices. This is particularly useful when switching phones or installing the app on additional devices.
Detailed Process:
Role of FamilyDocTracker: The restore process is primarily guided by the "FamilyDocTracker," a Google Sheet stored within the FamilyDocs folder in Google Drive. This sheet acts as the central repository for all app-related data, including file references, user settings, and other crucial metadata.
Initiating Restore: When a user initiates a restore on a new or existing device, the app connects to Google Drive and accesses the FamilyDocTracker.
Data Retrieval: The app reads the data from the FamilyDocTracker, which includes detailed records of all files and their associated metadata stored in the FamilyDocs folder.
Rebuilding App State: Using the information from the FamilyDocTracker, the app reconstructs its state on the new device. This includes downloading all necessary documents, restoring user settings, and re-establishing any specific configurations that were previously in place.
Consistency Across Devices: Once the restore is complete, the app on the new device mirrors the state of the app as it was on the original device. Any further changes made in the app on any device are synchronized with the FamilyDocTracker, ensuring all devices remain consistent with the master data.