Box Capture was born out of the need to ensure that workers in the field are just as connected to core business processes and workflows as their colleagues in the office. As the workforce of the 21st century becomes more mobile, we wanted to build a product that addresses the evolving landscape of knowledge workers in field-intensive industries: construction, retail, oil, and gas, to name a few. To that end, we sought out to design an app that infuses the simplicity of iOS with our enterprise-grade security and reliability that our customers have come to expect. In this post, we detail the engineering challenges and motivations behind building Capture.
Performance and Reliability
When a field worker performs an inspection and needs to record pictures or videos of a site, data reliability and fault-tolerance are qualities that we wanted to compose into a product that serves that workflow. It then becomes imperative that we design a data store that stashes away information reliably and efficiently. To help manage the complexity of juggling between online and offline access to data, we decided to use the open source library FMDB, an Objective-C wrapper of Apple's iOS sqlite3 implementation. It provided us with features such as fast write and read access to disk without compromising on the ability to query for arbitrarily large data sets, which proved to be useful for organizing content by date, upload state, or type. While FMDB exposes an abundance of features, we needed to be careful about threading and how that can adversely impact Capture. We achieved a thread-safe data store by simplifying the problem down with a straightforward observation: data either is or isn't uploaded onto Box. With this in mind, we maintained two separate databases to encapsulate access and threading: one for content pending for upload to Box, and one that caches content already uploaded to Box.
A key element we forged into Capture's user interface was speed. We were incredibly focused on making media uploads to Box super fast. However, we also wanted to preserve data not yet uploaded to Box in the event of a system crash or device hiccup. To protect our customers from unpredictability and lost work, we instrumented crash recovery mechanisms to gracefully restart with the most recent working copy of images or videos that the user was capturing. All media created using Capture is immediately written to disk for safekeeping and offloaded to our task manager to prepare for upload. That said, there were other parameters in our use cases we had to consider. We understand that workers out in the field may not have the most reliable 3G or LTE connection — this constraint influenced how we tailored our task manager to handle Box API operations while offline or in an area with a poor cell connection. Single unit tasks that represent API operations — such as move, delete, or rename — are queued and managed inside our persistent data store. Preserving the intent of the user, irrespective of having connectivity with Box's servers, governed our motivation for building a robust system that supports offline usage.
Building on the Box Platform
When we unveiled our mobile SDKs at Box Dev earlier this year, we were excited to see what developers built with them. For us, Box Capture became the perfect product to leverage our SDKs — the Content, Browse, Share, and Preview SDKs were instrumental to delivering a great user experience. We implemented critical components such as authentication, uploading, and folder browsing with minimal effort by plugging our SDKs into Capture. This allowed us to focus on other important features like user interactions, animations, and workflows. Though we didn't harness every feature and API in the SDKs, we employed a fair amount of them, which ultimately accelerated our development velocity. For example, our Share SDK made writing code to support sharing and external collaboration on captured content incredibly easy and painless. With only a few lines of code, spinning up a view controller with our enterprise-level sharing and collaboration suite of options propelled Capture into a convenient and powerful tool for quickly relaying information back to headquarters. The possibilities of products and services that can be built on our SDKs are limitless — Capture is one of many examples that showcases the functionality packaged into them.
We designed Capture with simplicity and usability in mind. Underneath that sheen, however, is a fair amount of complex layers working together to sustain that bar. We started with the idea that mobile workers in the 21st century expect tools that get out of the way when getting the job done. We then crafted the technical details around that intent and worked our way up from there. By designing a robust framework that reliably preserves content and unifying that with the power of our SDKs, we hope Capture serves the growing needs and demands of field workers in today's modern age. Box Capture is available today on the App Store.