Adding SmartStore to Existing Android Apps
Hybrid projects created with Mobile SDK 4.0 or later automatically include SmartStore. If you used Mobile SDK 4.0+ to create an Android native project without SmartStore, you can easily add it later.
To add SmartStore to an existing native Android project (Mobile SDK 4.0 or later):
-
Add the SmartStore library project to your project. In Android Studio, open your project’s
build.gradlefile and add a compile directive for:libs:SmartStorein thedependenciessection. If thedependenciessection doesn’t exist, create it. -
In your
<*projectname*>App.javafile, import theSmartStoreSDKManagerclass instead ofSalesforceSDKManager. Replace this statement:with this one:
-
In your
<projectname>App.javafile, change your App class to extend theSmartStoreSDKManagerclass rather thanSalesforceSDKManager.
- To add SmartStore to apps created with Mobile SDK 3.x or earlier, begin by upgrading to the latest version of Mobile SDK.
- The SmartStore plugin,
com.salesforce.plugin.smartstore.client, uses promises internally.
Mobile SDK promised-based APIs include:
force+promise.js- The
smartstoreclientCordova plugin (com.salesforce.plugin.smartstore.client) mobilesync.js
See Also