Developing Offline Mobile Apps with the Mobile SDK SmartStore, and SmartSync
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Developing Offline Mobile Apps with the Mobile SDK SmartStore, and SmartSync

Uploaded on

Dreamforce 2013 Session. At some point, all mobile app users lose their data signal. Join us to learn best-practices for coding for offline requirements with the Mobile SDK. We'll......

Dreamforce 2013 Session. At some point, all mobile app users lose their data signal. Join us to learn best-practices for coding for offline requirements with the Mobile SDK. We'll develop a simple app using SmartStore offline storage, highlighting the new SmartSQL and SmartSync features. With these tools, you can take your mobile apps to the next level, developing native and hybrid applications on iOS and Android that have offline access to your data.

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 1,982 1,945 17 9 5 3 2 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Setup: <br /> Xcode Open, build project <br /> Login to org, open Oppty <br /> Open Workbench <br /> Open Git Repo <br />
  • We’re more connected then ever, why bother with offline access? <br /> Wifi or Cell coverage might be nearly everywhere, but it’s not everywhere, and it’s coverage is often spotty even when you do have it <br /> Sales Reps, Service Reps need access to their information in the field… <br /> Photos Credits: <br /> Farm: <br /> Heavy Machinery: <br /> MRI: <br /> Elevator: <br />
  • Not just access to information, but also capturing data – don’t create a call log later, “check in” with the person you’re visiting, track what you did while you were there online or off. <br /> Demonstrate ROI by showing usage vs. performance, etc. <br />
  • Offline opportunities. <br /> Hybrid offline app, based on AccountEditor sample from SDK <br /> We’ll use it to illustrate SmartStore and SmartSync concepts <br />
  • This diagram lays out the different strengths and limitations of each of the three custom mobile app development options. <br /> Depending your requirements, the diagram provides a simple framework by which to evaluate the approach that’s best for you. <br /> ----------------------------------------------- <br /> KEY QUESTIONS: <br /> • Will you be standardizing on one device platform? Is offline access critical? Do you have plenty of time to build an app? If so, the Native app approach could work best. <br /> • Do you want to build an app in the fastest way possible? Do you prefer to the ‘write once – deploy anywhere’ approach? Then go with an HTML5 option. <br /> • Is Flexibility a high priority? Do you want added marketing visibility for your app through an app store and leverage native platform features? Then a Hybrid provides the best of both worlds <br />
  • SQLite, SQCipher, Smartstore <br /> <br />
  • SQLite, SQCipher, Smartstore <br /> <br />
  • Stores are sqlite files – you probably only need one. <br />
  • Soups hold JSON Docs <br />
  • Both API and SmartStore return JSON Docs <br />
  • BookedButton.js <br />
  • CODE!!! <br />


  • 1. Developing Offline Mobile Apps Salesforce Mobile SDK SmartStore and SmartSync Tom Gersic, Director, Mobile Services Delivery @tomgersic
  • 2. Safe harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available., inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 3. Tom Gersic Director, Mobile Services Delivery @tomgersic
  • 4. Agenda What we are going to build today Salesforce Mobile SDK Overview SmartStore Terminology SmartSync Terminology Walking through some code
  • 5. “I need this data, but my connection is awful!!!”
  • 6. Why offline?
  • 7. Data based decisions In the field, and by management
  • 8. What we’ll build today
  • 9. Mobile SDK Customer Data
  • 10. Three Options: Which One Is Right For You? Advanced UI interactions Fastest performance App store distribution Web developer skills Access to native platform App store distribution Web developer skills Instant updates Unrestricted distribution
  • 11. I swear this makes sense!
  • 12. I swear this makes sense!
  • 13. SmartSync
  • 14. Terminology
  • 15. Stores
  • 16. Soups • Hold Indexed JSON Documents • JSON Responses can encompass data from multiple tables Id Soup Created lastModified Index 1 Index 2 Index N… 1 {JSON} 1371069899796 1371070436125 a00E0000009Xj2mIAC … 2 {JSON} 1371069899802 1371070436126 a00E0000009Xj36IAC Facebook … 3 {JSON} 1371069899803 1371129103154 a00E0000004h2MnIAI Google …
  • 17. REST API Returns a JSON Response /services/data/v28.0/query/?q=SELECT Id, Name FROM Opportunity
  • 18. Some things you can do with your soup… • Register a Soup with an IndexSpec • Query a Soup using a QuerySpec • Upsert Data to a Soup • Delete Data from a Soup • Remove a Soup
  • 19. IndexSpec • JSON Object • Fields to index • “string” or “integer” [ {"path":"Id","type":"string"}, {"path":"Name","type":"string"} ]
  • 20. QuerySpec buildAllQuerySpec(path,order,pageSize) Query all records from the object in the given sort order (or null order) buildExactQuerySpec(path,matchKey,pageSize) Search for records with index path values matching the key. buildRangeQuerySpec(path,beginKey,endKey,pageSize) Return all records with an index path value between the two range values buildLikeQuerySpec(path,likeKey,order,pageSize) Basically “select * from [table] LIKE ‘%[likeKey]%’” buildSmartQuerySpec(smartSql,pageSize) Basically “select * from [table] LIKE ‘%[likeKey]%’”
  • 21. SmartSQL SELECT {departments:name}, {employees:lastName} FROM {employees}, {departments} WHERE {departments:deptCode} = {employees:deptCode} ORDER by {departments:name}, {employees:lastName}
  • 22. SmartSync • Extends Backbone.js • Can be used with or without a SmartStore Cache • Queries returned as Backbone Model Collections
  • 23. Backbone • MV* Framework • Models: Individual records • Collections: Collections of Model records • View: Javascript backing for the stuff that you see • Router: routes everything after the # in a URL to application functions •
  • 24. Force.SObject • sobjectType: Account, Opportunity, etc. • fieldlist: ["Id", "Name", "Amount", "StageName"] • cacheMode: client, server write order • mergeMode: how to handle conflicts • cache: if using SmartStore • cacheForOriginals: backup data for conflict detection
  • 25. Force.SObjectCollection • config: determines queries used to access data • cache: if using SmartStore • cacheForOriginals: backup data for conflict detection
  • 26. Force.StoreCache • soupName: Name of the SmartStore Soup • additionalIndexSpecs: IndexSpecs to use, in addition to defaults • keyField: Name of the field containing the record Id • __locally_created__ • __locally_updated__ • __locally_deleted__ • __local__ (set to true if any of the previous three are true)
  • 27. Patterns for Offline Success
  • 28. Offline Queueing
  • 29. Tom Gersic Director, Mobile Services Delivery @tomgersic
  • 30. @tomgersic