SalesforceMobileSDK-Shared

June 6, 2026 ยท View on GitHub

JavaScript source of truth for the Salesforce Mobile SDK hybrid (Cordova) stack.

This repository is included as a git submodule inside both SalesforceMobileSDK-Android (at external/shared/) and SalesforceMobileSDK-iOS-Hybrid (at external/shared/). Its generated files are also copied into SalesforceMobileSDK-CordovaPlugin.

libs/ -- Source JavaScript Files

These are the authoritative source files for the hybrid JavaScript layer:

FileDescription
cordova.force.jsCordova plugin bridge providing OAuth, SmartStore, MobileSync, Network, SDKInfo, and SFAccountManager plugins. These call into native code via cordova.exec().
force.jsCallback-based REST API client for Salesforce: SOQL, SOSL, CRUD operations, metadata describe, and automatic token refresh.
force+promise.jsPromise wrapper around force.js for async/await usage.
force+files.jsSalesforce Files API utilities: upload, download, and caching with base64 encoding.
mobilesync.jsData synchronization framework built on Backbone.js: sync down (SOQL/MRU targets), sync up, and conflict detection.

gen/plugins/com.salesforce/ -- Generated Cordova Plugin Files

These files are in Cordova plugin format and are what gets copied to SalesforceMobileSDK-CordovaPlugin/www/ by the CordovaPlugin's tools/update.sh script.

Do not edit these files directly. Edit the source in libs/ and regenerate.

  • com.salesforce.plugin.mobilesync.js
  • com.salesforce.plugin.network.js
  • com.salesforce.plugin.oauth.js
  • com.salesforce.plugin.sdkinfo.js
  • com.salesforce.plugin.sfaccountmanager.js
  • com.salesforce.plugin.smartstore.client.js
  • com.salesforce.plugin.smartstore.js
  • com.salesforce.util.bootstrap.js
  • com.salesforce.util.event.js
  • com.salesforce.util.exec.js
  • com.salesforce.util.logger.js
  • com.salesforce.util.promiser.js
  • com.salesforce.util.push.js

samples/ -- Sample Applications

HTML/JavaScript sample apps used by hybrid sample apps in the Android and iOS-Hybrid repos (which include this repo as a submodule):

  • accounteditor -- Account CRUD operations
  • contactexplorer -- Contact list browser with search
  • fileexplorer -- File upload and download
  • mobilesyncexplorer -- Offline data sync with MobileSync
  • simplesyncreact -- React-based sync sample
  • smartstoreexplorer -- SmartStore operations and Smart SQL
  • userandgroupsearch -- Combined user and group search
  • userlist -- User list display
  • usersearch -- User search
  • vfconnector -- Visualforce connector

To run a sample, create a hybrid app using the SDK templates, replace the app's www/ content with the sample code, and build for iOS or Android.

Submodule Usage

This repository is a git submodule at external/shared/ in both:

Hybrid sample apps in those repos reference JavaScript directly from the submodule. When changes are merged here, both repos must update their submodule pointer:

cd external/shared
git checkout dev
git pull origin dev
cd ../..
git add external/shared
git commit -m "Update Shared submodule"

Making Changes

  1. Edit source files in libs/.
  2. Regenerate the gen/plugins/com.salesforce/ files.
  3. Update the submodule reference in the Android and iOS-Hybrid repos.
  4. Run tools/update.sh in the CordovaPlugin repo to copy the new generated files into its www/ directory.

Version Management

setversion.sh updates the SDK version number in this repo:

./setversion.sh -v 14.0.0

This updates SALESFORCE_MOBILE_SDK_VERSION in libs/cordova.force.js and then automatically runs ./tools/update.sh to propagate the new version into all generated files under gen/plugins/com.salesforce/.

This script has no -d (isDev) flag โ€” version bumps here are unconditional. It is run on both dev and master branches as part of the release process.

RepositoryRole
SalesforceMobileSDK-CordovaPluginDistribution package for the Cordova plugin; copies generated files from this repo
SalesforceMobileSDK-AndroidNative Android SDK; hosts this repo as a submodule for hybrid apps
SalesforceMobileSDK-iOS-HybridNative iOS hybrid bridge; hosts this repo as a submodule for hybrid apps