- Import the
Cordovalibrary project in Eclipse by following the steps below:- Click File -> Import -> Existing Projects into Workspace.
- Navigate to the root of the Mobile SDK workspace, and select the
Cordovaproject.
- Replace the existing
SalesforceSDKproject in Eclipse with the Mobile SDK 2.3.0SalesforceSDKproject. - If your app uses
SmartStore, replace the existingSmartStoreproject in Eclipse with the newSmartStoreproject. - Right click your project and select
Properties. - Click the
Androidtab and navigate to the library project section at the bottom. - Replace the existing
SalesforceSDKentry with the newSalesforceSDKproject in your workspace. - If your app uses
SmartStore, repeat the previous step for theSmartStoreproject.
The 2.3 version of the Mobile SDK uses Cordova 3.5, which represents both a significant upgrade from the previous Cordova 2.3, and a signficant change in how you bootstrap your application. Please follow the instructions below to migrate your hybrid app to the Cordova 3.5 paradigm.
- You will need to install the
cordovacommand line tool from https://www.npmjs.org/package/cordova. Theforcedroidpackage depends on thecordovatool to create hybrid apps. Make sure you have version 3.5 or greater installed. - You will also need to install the
forcedroidnpm package from https://www.npmjs.org/package/forceidroid, to create your new hybrid app.
Follow the instructions in the forcedroid package to create your new hybrid app. You'll choose either a hybrid_remote or hybrid_local app, depending on the type of hybrid app you've developed.
- Once you've created your new app,
cdinto the top level folder of the new app you've created. - Run
cordova plugin add [Cordova plugin used in your app]for every plugin that your app uses. Note: You do not need to do this for the Mobile SDK plugins, as theforcedroidapp creation process will automatically add those plugins to your app. - Remove everything from the
www/folder, and replace its contents with all of your HTML, CSS, (non-Cordova) JS files, andbootconfig.jsonfrom your old app. Basically, copy everything from your oldwww/folder except for the Cordova and Cordova plugin JS files. Cordova is responsible for pushing all of the Cordova-specific JS files, plugin files, etc., into yourwww/folder when the app is deployed (see below). - For any of your HTML pages that reference the Cordova JS file, make sure to change the declaration to
<script src="cordova.js"></script>, i.e. the generic version of the Cordova JS file. The Cordova framework now handles the versioning of this file. - Remove any
<script src="[Some Plugin JS File]"></script>references in your HTML files. Cordova is responsible for handling the inclusion of the proper plugin JS files in your app. - Make sure that any calls in your code to
cordova.require()do not happen before Cordova'sdevicereadyevent has fired. - The naming convention for our Cordova plugins has changed, to reflect the new conventions used in Cordova 3.5. Specifically, dot separation has replaced '/' separation for namespacing. For example, if your app previously called
cordova.require('salesforce/util/logger'), you would now call that viacordova.require('com.salesforce.util.logger'). Generally:- Replace
salesforcewithcom.salesforce. - Replace '/' with '.'
- Replace
- Run
cordova prepare, to stage the changes into your app project(s). Generally speaking, you'll runcordova prepareafter any changes made to your app code, and Cordova will stage all of the appropriate changes into your app project(s).
Please see the Mobile SDK Development Guide for more information about developing hybrid apps with the 2.3 SDK and Cordova 3.5.