Download & Install

The HTC OpenSense SDK provides the HTC APIs from within the standard Android SDK platform. It consists of an Android SDK add-on that can be installed through the Android SDK manager.

Prerequisites

If developing in Eclipse:

Install Android SDK components:

From the command line run the android command to launch the Android SDK Manager: [location of android-sdk]/tools/android

From Eclipse, launch the Android SDK Manager from either the Window menu or the shortcut icon:


If you haven't done so, install the Android SDK Platform component for API Level 15 from available packages and confirm installation:


Note: You can uninstall any previous HTC add-ons, the new add-on replaces those.


1) Open the SDK manager

2) From the "Tools" menu select 'Manage Add-on Sites...'

3) Click on "User Defined Sites"

4) Create a new add-on site using the following URL: http://dl.htcdev.com/apis

Note: '/addons.xml' gets added automatically so the following URL will be listed: http://dl.htcdev.com/apis/addon.xml


Note: You can uninstall any previous HTC add-ons, the new add-on replaces those.


5) Close the Add-on Sites window and from the main Android SDK Manager window, select the HTC add-on to download and install it.




Installing sample code projects from Eclipse:

  1. File -> Import... -> Existing Projects into Workspace
  2. Select Root Directory: Select the samples folder for the corresponding add-on folder found under your Android SDK installation
  3. Check the checkbox for Copy Projects into workspace (to prevent overwriting sample code)
  4. Click on Finish
  5. You can start browsing the projects in the Package Explorer.

Run the sample in the emulator

NOTE: Only the PenEventCompatibilityDemo, PenTouchPaint and LockScreenSupportDemo sample projects are supported in the emulator. Please see sample code section for more information on using the pencompatibility jar file for pen applications as well as the htcsupportapis.jar library as used by the LockScreenSupport sample project..

From Eclipse:

  1. Select the sample project in the Package Explorer
  2. Click the Run (or Run As...) button in the toolbar or from the Project menu or from the project context menu(right click on project)
  3. In the Run As window, select Android Application
  4. The Android emulator is started automatically if no device is connected and the sample app is launched. For most of the sample projects, an HTC device with Sense 4.0 is recommended