At Salesforce, we’ve referred to micro moments when discussing Mobile Solutions. Essentially, these are small amounts of time that users find in-between their daily tasks that can be used for productivity. This meant designers of mobile solutions had to think about how to deliver bite-sized use cases in their applications.
The introduction of Wearable technology, specifically smart watches, extends this concept even further. The smart watch allows you to take advantage of even smaller windows of time; these can be thought of as nano moments. This introduces new design challenges: Performance is even more important: The user is unlikely to keep looking at their watch while a network operation completes; and the amount of screen real estate is even smaller: How do we present the minimal information necessary for the job?
I’ve created a Salesforce Watch demo app for Apple Watch. The full demo, including the design pattern and code to implement it are presented in my article, Building a Salesforce Events Sample Watch App. The article and sample app extends my previous blog post explaining how we can use App Groups to share credentials data between the Parent App and the Watchkit Extension. In that model, the Watchkit extension was responsible for the data-level interactions (i.e. REST API calls) with Salesforce. There was one key drawback to that initial approach. The performance of the solution was heavily influenced by network latency. Given the aforementioned nano moments concept, this might not provide a great user experience.
Since that blog post was written, there have been a couple of improvements that allow us to create a better user experience:
- In the subsequent beta versions of the Watchkit (from Version 2 onwards), Apple has provided a mechanism to be able to communicate with the Parent App (openParentApplication).
- The Salesforce Mobile SDK has been updated to include Smartsync capability for native iOS apps.
I’ll summarize the design pattern here. See the full article for details.
Offline/Online Pattern for Apple Watch
The app I’m building is a simple Salesforce Events Watch App. I’d like to provide an offline/online solution for the user as shown here:
One key design consideration is that the user needs to be able to see the events immediately upon launching the app. This means having to use offline storage. However, we need to inform the user of the currency of the information (i.e. when was it last synced). This is so the user can determine for themselves how much they can rely on that information.
Also, when the user is presented with cached data that was old, we want to issue a sync request for that information and present the updated information when it becomes available.
The above sequence diagram shows this pattern in action. To summarize, the Parent App establishes the OAUTH flow and syncs the records using SmartSync. When the Watch App launches, it invokes a function in the Parent App using the openParentApplication method call. The Parent App immediately responds with the records in its local store and the time when the last sync was performed. If the last sync time was greater than 60 seconds ago (interval can be configured based on use case), the Parent App also initiates another sync.
About the Salesforce Watch Demo App
The demo app implements this design pattern and was created based on the Native REST App template in the Salesforce Mobile SDK. The login host can be configured in system Settings on the device. You can switch between Production, Sandbox, or a custom host if needed. The full article walks through code. For example, the current Watchkit SDK doesn’t provide an ability for the Parent App to invoke methods in the Watchkit Extension. So, the Watchkit Extension must periodically poll back to determine if the sync has completed. In this example, the extension polls every three seconds, and stops polling after a maximum of three attempts.
Hopefully, the demo app can serve as starting point for developing your own Salesforce Watch Apps.
Salesforce Services Mobile & Emerging Technologies
The Salesforce Services Mobile & Emerging Technologies practice is dedicated to helping Salesforce customers achieve more through mobility and driving innovation. With hundreds of custom mobile projects under our belt, our dedicated practice has years of experience building enterprise mobile solutions with Salesforce technologies.
If you want help transforming your business with Salesforce, contact us via your Salesforce Account Executive, Salesforce Services Business Development Manager, or Success Services today.”