- Replace the existing
SalesforceSDK
project in Eclipse with the Mobile SDK 2.1.0SalesforceSDK
project. - If your app uses
SmartStore
, replace the existingSmartStore
project in Eclipse with the newSmartStore
project. - Right click your project and select
Properties
. - Click the
Android
tab and navigate to the library project section at the bottom and replace the existingSalesforceSDK
entry with the newSalesforceSDK
project in your workspace. - If your app uses
SmartStore
, repeat the previous step for theSmartStore
project. - The Salesforce Mobile SDK Activity and Service declarations have now been moved from the app's
AndroidManifest.xml
file to theAndroidManifest.xml
file of theSalesforceSDK
project. These declarations are automatically merged into the app's manifest file if you enable themanifestmerger
attribute. In order to use this, addmanifestmerger.enabled=true
to your app'sproject.properties
file.- NOTE:
- You are required to perform this step to use features that were added in Mobile SDK 2.1.0, such as push notifications.
- NOTE:
- Swap the existing
SalesforceSDK
project in Eclipse with the newSalesforceSDK
project (if your app usesSmartStore
, replace the existingSmartStore
project in Eclipse with the newSmartStore
project). - Right click on your project and go to
Properties
. - Click on the
Android
tab and replace the existingSalesforceSDK
entry at the bottom (in the library project section) with the newSalesforceSDK
project in your workspace (repeat this step with theSmartStore
project, if your app usesSmartStore
). - Classes that extend
ForceApp
orForceAppWithSmartStore
should now extendApplication
instead. Let us call this classSampleApp
for the purpose of this exercise. - Create a new class that implements
KeyInterface
, sayKeyImpl
for instance. Move the implementation ofgetKey()
fromSampleApp
intoKeyImpl
. ForceApp
has been renamed toSalesforceSDKManager
andForceAppWithSmartStore
has been renamed toSalesforceSDKManagerWithSmartStore
.- Replace all occurrences of
ForceApp
orForceAppWithSmartStore
withSalesforceSDKManager
andSalesforceSDKManagerWithSmartStore
respectively. - Update the app's class imports to reflect this change.
- Replace all occurrences of
ForceApp.APP
orForceAppWithSmartStore.APP
withSalesforceSDKManager.getInstance()
andSalesforceSDKManagerWithSmartStore.getInstance()
respectively.
- Replace all occurrences of
- In the
onCreate()
method ofSampleApp
, add the following line of code.SalesforceSDKManager.initNative(getApplicationContext(), new KeyImpl(), <mainActivityClass>.class);
, where<mainActivityClass>
is the class that should be launched once the login flow is complete.- NOTE:
- If your app supplies its own login activity, this may be passed in as an additional argument to the
initNative()
method call (look at the available method signatures ofinitNative()
inSalesforceSDKManager
). - If your app uses SmartStore, the aforementioned line of code should be replaced with
SalesforceSDKManagerWithSmartStore.initNative()
instead (look at the available method signatures ofinitNative()
inSalesforceSDKManagerWithSmartStore
).
- If your app supplies its own login activity, this may be passed in as an additional argument to the
- Remove the overridden methods of
ForceApp
fromSampleApp
, such asgetKey()
,getMainActivityClass()
and any other overridden methods. - It is not required to create
LoginOptions
through code and pass them in anymore. The Salesforce Mobile SDK now automatically reads these options from an XML filebootconfig.xml
, which resides in theres/values
folder of your project.- Create a file called
bootconfig.xml
under theres/values
folder of your project and move the app's login options from code tobootconfig.xml
(look atbootconfig.xml
underres/values
of the SalesforceSDK project or one of the native sample apps for an example).
- Create a file called
NativeMainActivity
has been renamed toSalesforceActivity
and moved to a new packagecom.salesforce.androidsdk.ui.sfnative
.- If any of your app's classes extend
NativeMainActivity
, replace all references toNativeMainActivity
withSalesforceActivity
. - Update the app's class imports to reflect this change.
- If any of your app's classes extend
- The SmartStore package has been changed to
com.salesforce.androidsdk.smartstore
. If you app uses the SmartStore project, update the app's class imports and other code references to reflect this change.
- Swap the existing
SalesforceSDK
project in Eclipse with the newSalesforceSDK
project (if your app usesSmartStore
, replace the existingSmartStore
project in Eclipse with the newSmartStore
project). - Right click on your project and go to
Properties
. - Click on the
Android
tab and replace the existingSalesforceSDK
entry at the bottom (in the library project section) with the newSalesforceSDK
project in your workspace (repeat this step with theSmartStore
project, if your app usesSmartStore
). - Classes that extend
ForceApp
orForceAppWithSmartStore
should now extendApplication
instead. Let us call this classSampleApp
for the purpose of this exercise. - Create a new class that implements
KeyInterface
, sayKeyImpl
for instance. Move the implementation ofgetKey()
fromSampleApp
intoKeyImpl
. ForceApp
has been renamed toSalesforceSDKManager
andForceAppWithSmartStore
has been renamed toSalesforceSDKManagerWithSmartStore
.- Replace all occurrences of
ForceApp
orForceAppWithSmartStore
withSalesforceSDKManager
andSalesforceSDKManagerWithSmartStore
respectively. - Update the app's class imports to reflect this change.
- Replace all occurrences of
ForceApp.APP
orForceAppWithSmartStore.APP
withSalesforceSDKManager.getInstance()
andSalesforceSDKManagerWithSmartStore.getInstance()
respectively.
- Replace all occurrences of
- In the
onCreate()
method ofSampleApp
, add the following line of code.SalesforceSDKManager.initHybrid(getApplicationContext(), new KeyImpl());
.- NOTE:
- If your app supplies its own login activity, this may be passed in as an additional argument to the
initHybrid()
method call (look at the available method signatures ofinitHybrid()
inSalesforceSDKManager
). - If your app uses SmartStore, the aforementioned line of code should be replaced with
SalesforceSDKManagerWithSmartStore.initHybrid()
instead (look at the available method signatures ofinitHybrid()
inSalesforceSDKManagerWithSmartStore
).
- If your app supplies its own login activity, this may be passed in as an additional argument to the
- Remove the overridden methods of
ForceApp
fromSampleApp
, such asgetKey()
,getMainActivityClass()
and any other overridden methods. - The SmartStore package has been changed to
com.salesforce.androidsdk.smartstore
. If you app uses the SmartStore project, update the app's class imports and other code references to reflect this change. bootconfig.js
has been replaced withbootconfig.json
. Convert your existingbootconfig.js
to the newbootconfig.json
format (look at the sample apps for examples on how to do this).- The SalesforceSDK Cordova plugins, namely
SFHybridApp.js
,SFSmartStorePlugin.js
, andSalesforceOAuthPlugin.js
have been combined into a single filecordova.force.js
.- Replace these three Cordova plugin files with
cordova.force.js
. - Replace all references of
SFHybridApp.js
,SFSmartStorePlugin.js
, andSalesforceOAuthPlugin.js
, withcordova.force.js
.
- Replace these three Cordova plugin files with
forcetk.js
has now been renamed toforcetk.mobilesdk.js
. Replace the existing copy offorcetk.js
with the latest version offorcetk.mobilesdk.js
and update all references toforcetk.js
to the new name.bootstrap.html
is no longer required and can be safely removed.SalesforceDroidGapActivity
andSalesforceGapViewClient
have been moved to a new package, namelycom.salesforce.androidsdk.ui.sfhybrid
. If your app references these classes, update those references and class imports.