Develop apps for SmartWatch & Smart Wireless Headset pro with the new Sony Add-on SDK
You’ve all been able to develop app extensions for SmartWatch and Smart Wireless Headset pro for a while with the old Smart Extension SDK, but now we have replaced this with the new Sony Add-on SDK. So far, hundreds of apps have been created or extended to work with these devices. Read on for a walkthrough of the most useful facts and tips, for those of you looking to develop an app for SmartWatch and Smart Wireless Headset pro with the Sony Add-on SDK (and learn more about the SmartWatch update being released today!).
Sony SmartWatch and Sony Smart Wireless headset pro.
Create new use cases – get more visibility
There are two main reasons to why you would should develop an app, or extend your existing app, for SmartWatch or Smart Wireless Headset pro (the app will still be installed on your smartphone or tablet, and not on the accessory).
First of all, it’s a possibility to create really innovative use cases, where you can utilise the features of the smartphone or tablet without even picking it up from your bag or pocket, by extending the app functionality to SmartWatch or Smart Wireless Headset pro. With the SmartWatch and the Smart Wireless Headset pro, you have a way to keep the user discreetly updated about text, time, calls, music, emails, Facebook and much more. SmartWatch is also supporting multi touch, and it’s scratch and splash proof.
Secondly, you can also get a lot extra visibility to your app. If you develop an app for these accessories, it will be visible to all end users as when they look for more apps through the Smart Connect app. All compatible apps will be displayed, in a pre-defined search on Google Play™. Basically you just have to add the search string “LiveWare™ extension for SmartWatch” in you Google Play description (for SmartWatch). For more details, check out the SmartWatch and Smart Wireless Headset pro white papers in the Sony Add-on SDK documentation kit to learn more on how to make your app show up in the Smart Connect app.
How it all works
To make your app work with SmartWatch and Smart Wireless Headset pro, you will be using the Smart Extension APIs which are available in the Sony Add-on SDK. The Smart Extension APIs are easy to use, intent-based APIs, which makes it possible to access the display, widgets, notifications and other general controls on the accessories. All the communication between your app (running on the smartphone or tablet) and the accessories goes over Bluetooth™, and the communication and interaction itself is handled through the Smart Connect app and the host apps.
Smart Extension architecture.
Apps or part of apps that can interact with SmartWatch, and Smart Wireless Headset pro, are called Smart Extensions in our terminology. The interaction mechanism works so that what you see on the accessory display is actually rendered by the app on the phone. Touch and key events are sent to the apps on the smartphone or tablet, which in return sends new images to SmartWatch which are then rendered on the screen. For more information on how the architecture, interaction and communication works, check out the Sony Add-on SDK section on Developer World, as well as the Sony Add-on SDK documentation kit.
Several APIs available
The Smart Extension APIs consists of the following APIs:
Registration and Capabilities API: this API is used by the host application to inform your app (Smart Extension) about the capabilities of the accessory. It is also used by your Smart Extension to inform the host application about which of the other APIs that are used.
Notification API: this API is typically used by simple event driven data providers such as SMS text message, MMS, Missed calls, Facebook™, Twitter™ and so on.
Control API: this is the most advanced API, giving you full control of the accessory screen. It lets you control and draw on the entire screen, use the vibrator, update the screen and get input events (swipe and touch).
Widget API: this is an API enabling you to display a widget on the accessory, when you you want to display minor information quickly. This API cannot be used for Smart Wireless Headset pro.
Sensor API: this API makes the sensor data of the accessory (accelerometer data from the 3-axis accelerometer on SmartWatch) available to your app. This API cannot be used for Smart Wireless Headset pro.
Smart Extension API functionality.
Start developing – install the Sony Add-on SDK
To start developing an app or extending an existing app for SmartWatch or Smart Wireless headset pro, install the Sony Add-on SDK, download the Sony Add-on SDK documentation kit and follow the instructions in the Smart Extension documentation. Once you’ve installed the Sony Add-on SDK, you will find code examples, an emulator and extensive Javadocs.
Start with the Smart Extension API code examples
There are several Smart Extension API code examples available in the Sony Add-on SDK, which you can use as tutorials or templates:
SmartExtensionAPI – a code example that defines the Smart Extension API. We recommend that all Smart Extensions include these classes.
SmartExtensionUtils – a code example with helper classes that might be useful when developing Smart Extension apps.
SampleControlExtension – a Smart Extension app that shows how to use the Control API.
SampleNotificationExtension – a Smart Extension app that uses the Notification API to send text messages to the accessory.
SampleWidgetExtension – a Smart Extension app that uses the Widget API to show the current time on the accessory widget level.
SampleSensorExtension – a Smart Extension app that uses the Sensor API and the Control API to show the accessory accelerometer readings on the accessory.
You can import these code examples into Eclipse or any other build environment, and they are intended to be used as reference resources. Remember to change the package name for your app before publishing it on Google Play, if you have built it on one of our code examples.
The code examples come with liberal open source licenses and they are basically free to use (check the license in the code exemple files for exact details). For more information about these code examples, check out the Tutorial for Smart Extension code examples document in the Sony Add-on SDK documentation kit.
Also, keep in mind to design you application extension with power consumption in mind. For example, if you keep the accessory screen on, it will drain the battery and give a poor user experience.
Two additional open sourced SmartWatch apps
Besides the code examples in the Sony Add-on SDK, there are two additional apps for SmartWatch released as open source. First off, the Music Extension, which extends your music player to the SmartWatch display, and then 8 Game, which is a game that can be played on the SmartWatch. With the Sony Add-on SDK, you can use these apps as a base for creating your own music player extension or game. Read more about these extensions and how to use them in the blog post Music Player and 8 Game for SmartWatch released as open source.
Use the Smart Extension emulator
In the Sony Add-on SDK, there is also an emulator for the SmartWatch, which runs on your phone once you have installed it. This way you can emulate both the SmartWatch and Smart Wireless Headset pro. The emulator provides a simplified user interface, but also contains additional information for developers.
It’s a really good idea to test your extension app using the emulator. In the emulator you can verify that the extension works for the supported accessories, or if you do not intend to have support for all accessories, you can check that you have registered the extension correctly. If you register support for accessories unintentionally, it could lead to unwanted application crashes.
The Smart Extension emulator APK file is part of the Sony Add-on SDK and can be found in the apk folder. For installation instructions, see the Smart Extension emulator overview document in the Sony Add-on SDK documentation kit. Please note that sensors cannot be emulated, as they are hardware dependant.
Create widgets for SmartWatch
The widget functionality in the SmartWatch is a great way to show quick information and notifications, similar to how a widget works on the smartphone or tablet. Basically a widget is a live image that reflects the latest information from your app.
If you’re using the Widget API for your app, you can in some cases also implement one of the other APIs. You can for example make input events to work, and take actions based on them, for example to update the widget, start or stop something on the phone, or to start a “Control extension” (using the Control API). For more information on how to use the Widget API, see the Specification for Smart Extension APIs document in the Sony Add-on SDK documentation kit.
When creating a widget for the SmartWatch, you can draw on parts of the screen, as illustrated below. For more information on how to design a widget, and to see what options are available, please go over the Smart Extension UI guidelines document in the Sony Add-on SDK documentation kit. To keep the look of the widgets consistent, it’s really important to use the widget design elements described in this documentation.
SmartWatch widget framework.
Questions?
If you have any questions while you’re developing Smart Extensions, check out the Troubleshooting sections in the Sony Add-on SDK documentation kit. If you have any questions the installation or emulator setup, there is also a Troubleshooting section on the Install page.
If you can’t find an answer to your question, you can post Sony Add-on SDK developer related questions on the Stack Overflow forum. We have a team of Sony developers that constantly monitors, contributes and replies to questions regarding our products and tools at Stack Overflow. This way, your question and our answer can be shared, viewed and used by many people.
So if you have a question, just make sure you add the term “Sony” to your question. Then we should be able to catch your question, and support you in your development!
No comments: