Create a Template Project
First, make sure you’ve installed Salesforce Mobile SDK using the NPM installer. For iOS instructions, see iOS Preparation. For Android instructions, see Android Preparation.
Also, download the ratchet.css file from http://goratchet.com/.
Once you’ve installed Mobile SDK, create a local hybrid project for your platform.
-
At a Terminal window or Windows command prompt, run the forcehybrid create command using the following values:
| Prompt (or Parameter) | Value |
|---|
Platform (--platform) | ios, android, or ios,android |
Application type (--apptype) | hybrid_local |
Application name (--appname) | UserSearch |
Package name (--packagename) | com.acme.usersearch |
Organization (--organization) | “Acme Widgets, Inc.” |
Output directory (--outputdir) | Leave blank for current directory, or enter a name to create a new subdirectory for the project |
Here’s a command line example:
1forcehybrid create --platform=ios,android --apptype=hybrid_local
2 --appname=UserSearch --packagename=com.acme.usersearch
3 --organization="Acme Widgets, Inc." --outputdir=""
-
Copy all files—actual and symbolic—from the samples/usersearch directory of the https://github.com/forcedotcom/SalesforceMobileSDK-Shared/ repository into the www/ folder, as follows:
-
In a Mac OS X terminal window, change to your project’s root directory—./UserSearch/—and type this command:
1cp -RL <INSERT LOCAL PATH TO SALESFORCEMOBILESDK-SHARED>/samples/UserSearch/* www/
-
In Windows, make sure that every file referenced in the <*shared repo*>\samples\usersearch folder also appears in your <*project_name*>\www folder. Resolve the symbolic links explicitly, as shown in the following script:
1cd <YOUR PROJECT'S ROOT DIRECTORY>
2set SHARED_REPO=<INSERT LOCAL PATH TO SALESFORCEMOBILESDK-SHARED>
3copy %SHARED_REPO%\samples\usersearch\UserSearch.html www
4copy %SHARED_REPO%\samples\usersearch\bootconfig.json www
5copy %SHARED_REPO%\dependencies\ratchet\ratchet.css www
6copy %SHARED_REPO%\samples\common\styles.css www
7copy %SHARED_REPO%\test\MockCordova.js www
8copy %SHARED_REPO%\samples\common\auth.js www
9copy %SHARED_REPO%\dependencies\backbone\backbone-min.js www
10copy %SHARED_REPO%\libs\cordova.force.js www
11copy %SHARED_REPO%\dependencies\fastclick\fastclick.js www
12copy %SHARED_REPO%\libs\ www
13copy %SHARED_REPO%\libs\force+promise.js www
14copy %SHARED_REPO%\dependencies\jquery\jquery.min.js www
15copy %SHARED_REPO%\libs\ www
16copy %SHARED_REPO%\samples\common\stackrouter.js www
17copy %SHARED_REPO%\dependencies\underscore\underscore-min.js www
-
Run the following command:
-
Open the platforms/android/ project folder in Android Studio (for Android) or Xcode (for iOS) by following the onscreen instructions printed by forcehybrid.
-
From the www folder, open UserSearch.html in your code editor and delete all its contents.
Welcome to the new home of the Mobile SDK Developer Guide! For now, the Japanese guide can be found in PDF form.