Skip to main content
Il 30 ottobre 2026 la Trailblazer Community online sarà disponibile solo in modalità di sola lettura per consentirci di trasferire le nuove conversazioni della community su Slack. Leggi le domande frequenti

Go Offline and Stay Secure

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain how SmartStore and Mobile Sync enable offline-first behavior.
  • Describe how to add biometric authentication via a follow-up prompt.

The Offline Challenge

Marcus is a Northern Trail Outfitters (NTO) field sales rep. He drives through rural areas where cell service is spotty at best. When he visits a customer site, he needs to pull up their account details, review recent opportunities, and log notes—all without waiting for a network connection. If the app doesn't work offline, Marcus can't do his job.

This is where SmartStore and Mobile Sync come in. Together, they create an offline-first experience that feels seamless, even when the device has zero connectivity.

SmartStore Encrypted On-Device Storage

SmartStore is the encrypted on-device database in Mobile SDK. It stores Salesforce records locally so the app can access them instantly, even with no network connection.

Here's what SmartStore provides.

  • Soup definitions: A "soup" is a collection of records, like a table in a database. Sophia's generated app has separate soups for Accounts and Contacts.
  • Indexing strategies: SmartStore indexes fields Sophia queries frequently, like Account Name or Contact Email, for fast lookups.
  • Query patterns: The skill generates correct query syntax for retrieving records from soups, which includes filtering and sorting.

Now when Marcus opens an Account, the app queries the local SmartStore soup—no network call needed. The data is already there.

Mobile Sync Bidirectional Sync

SmartStore handles local storage, but how does data get into SmartStore in the first place? That's where Mobile Sync comes in.

Mobile Sync manages bidirectional synchronization between the app and Salesforce.

  • Sync targets: Define what data to sync such as accounts, contacts, and custom objects.
  • Sync-down policies: Control when and how data flows from Salesforce to the device. For example, sync all Accounts owned by the current user.
  • Sync-up policies: Control when and how local changes are pushed back to Salesforce.
  • Conflict resolution: Handle cases where the same record was changed both on the device and in the cloud.

How It Works in Practice

When Marcus logs in with a good connection, Mobile Sync runs a sync-down. It pulls relevant accounts and contacts into SmartStore. This priming step ensures the data is ready before he heads into the field. Then Marcus loses signal. He opens an account—which reads directly from SmartStore—updates a contact's phone number, and logs a note. Each change writes to SmartStore, and the app queues these modifications as "dirty records." When Marcus gets a signal again, Mobile Sync detects the connection, pushes the dirty records to Salesforce, handles any conflicts, and refreshes the local store.

Marcus never thinks about sync—it just works.

Offline-First Combines SmartStore and Mobile Sync

Here's the key insight—true offline-first behavior requires both SmartStore and Mobile Sync configured correctly. It's not enough to cache data. You need these features.

  • Correct soup definitions with appropriate indexes
  • Sync targets that fetch the right data
  • Sync policies that handle bidirectional flow
  • Conflict resolution that doesn't lose data
  • Edge-case handling for network transitions, failed syncs, and dirty records

Mobile Procode Skills handle all of this from a single prompt. When Sophia asked for offline access to accounts and contacts, the skill generated the right SmartStore and Mobile Sync configurations, tested and proven in production Salesforce apps.

Add Biometric Authentication

Now that Marcus's app works offline, Sophia wants to add an extra security layer. If Marcus leaves his phone unattended at a job site, she wants to ensure no one can access customer data without his face or fingerprint.

Sophia doesn't need to start over or manually integrate biometric APIs. She opens her AI assistant and enters "Add Face ID authentication to the app login flow."

Here’s what the skill knows.

  • On iOS: This means integrating LAContext from LocalAuthentication and handling Face ID, Touch ID, and fallback to passcode.
  • On Android: This means using BiometricPrompt and handling fingerprint, face unlock, and fallback flows.
  • Security best practices: This includes measures such as prompt timing, error handling, and graceful degradation if biometrics aren't available.

The skill generates the correct implementation, integrates it into the existing OAuth flow, and ensures the user experience is smooth.

Platform Differences Handled for You

Here's what Sophia doesn't have to worry about.

  • iOS Face ID requires an NSFaceIDUsageDescription entry in Info.plist: The skill adds it.
  • Android requires USE_BIOMETRIC permission in AndroidManifest.xml: The skill adds it.
  • Fallback flows when biometrics fail or aren't enrolled: The skill implements them.
  • Correct sequencing—authenticate with biometrics, then fetch OAuth tokens: The skill gets the order right.

Sophia describes what she wants in natural language. The skill handles the platform-specific implementation details.

Why This Approach Scales

Marcus isn't the only user benefiting from offline and security. As NTO rolls out the app to hundreds of field reps, the offline-first architecture ensures the app works in remote areas, and biometric authentication ensures customer data stays secure even if a device is lost or stolen.

Now that you've seen how SmartStore, Mobile Sync, and biometric auth work, explore how to extend the generated app with additional features.

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback