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.gradle
file and add a compile directive for:libs:SmartStore
in thedependencies
section. If thedependencies
section doesn’t exist, create it. -
In your
<*projectname*>App.java
file, import theSmartStoreSDKManager
class instead ofSalesforceSDKManager
. Replace this statement:with this one:
-
In your
<projectname>App.java
file, change your App class to extend theSmartStoreSDKManager
class 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
smartstoreclient
Cordova plugin (com.salesforce.plugin.smartstore.client
) mobilesync.js
See Also