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 the dependencies section. If the dependencies section doesn’t exist, create it.
1dependencies { 2... 3 compile project(':libs:SmartStore') 4} -
In your <projectname>App.java file, import the SmartStoreSDKManager class instead of SalesforceSDKManager. Replace this statement:
1import com.salesforce.androidsdk. 2 app.SalesforceSDKManagerwith this one:1import com.salesforce.androidsdk.smartstore.app.SmartStoreSDKManager - In your <projectname>App.java file, change your App class to extend the SmartStoreSDKManager class rather than SalesforceSDKManager.