- Use these code examples to help you with your SmartWatch 2 app development.
- Code examples are available in the samples folder of the Sony Add-on SDK package.
You can find code example projects that illustrate some common SmartWatch 2 app use cases. These can also be used as a template to start developing your own app. The following SmartWatch 2 code examples are available in the samples folder of the Sony Add-on SDK:
- SmartExtensions – BackwardsCompatibleControl – Shows how to build a Control API app that runs on both SmartWatches.
- SmartExtensions – BackwardsCompatibleWidget – Shows how to build a Widget API app that runs on both SmartWatches.
- SmartExtensions – ClockWidget – Shows how to build a custom watch face.
- SmartExtensions – HelloActiveLowPower – Shows you how to take advantage of keeping your app running while the backlight is off, saving battery power.
- SmartExtensions – HelloEvents – Shows you how to use the options menu, vibrations and touch events. Also shows how to update an activity on the phone based on the event (for example, tapping an item in the Options Menu updates the Activity with which item was tapped).
- SmartExtensions – HelloLayouts – Shows you how to create a UI with bitmaps and layouts. Also includes how to handle touch events depending on whether it’s a bitmap or a layout-based UI.
- SmartExtensions – HelloNotification – Shows you how to send basic notifications to the accessory from an activity on your phone.
- SmartExtensions – HelloSensors – Shows you how to collect sensor values from SmartWatch 2, such as accelerometer and light. The sample also updates the SmartWatch 2 screen with the sensor data.
- SmartExtensions – HelloWidget – Shows you how to create a widget that can be placed on the SmartWatch 2 watch face.
- SmartExtensions – StateWidget – Shows how to draw different layouts depending on the SmartWatch 2 screen state.
The following projects are libraries that are necessary to compile and run all SmartWatch 2 app projects, so you will always need to include these in any project you create.
- SmartExtensions – SmartExtensionAPI – Library that includes the API definitions for SmartExtensions.
- SmartExtensions – SmartExtensionUtils – Utility library for SmartExtensions APIs.