As part of ongoing contributions to the open source community, we’re today releasing two extensions for the Sony SmartWatch as open source. The first one is an extension to the Music player, which makes it possible to control the music player in your phone from SmartWatch. The second extension is called 8 Game, a puzzle game that can be played on the SmartWatch. With our Sony Add-on SDK, you can use these apps as a base for creating your own music player extension or game for SmartWatch. This is an excellent opportunity to get an innovative edge on your competition, and to get better visibility as your app will be easy to find for all SmartWatch users.
Continue reading for downloads, details on the extensions and instructions how to use them!
Extend your music player to SmartWatch with the Music extension
The Music extension is used to control music playback on the phone from the SmartWatch accessory. It shows the track currently being played and you can start or pause playback, go to next track, go to previous track and control the volume. The open source version of the Music extension works with the Android vanilla Music player or by emulating media button key events.
The Music extension is designed to make it easy to integrate your own music player. In the Music extension, each supported player is interfaced through the PlaybackService interface. The Music extension already includes the GenericPlaybackService for the Android vanilla Music player, and the MediaButtonPlaybackService that sends MediaButtonIntents to the player registered in the Android AudioManager. To make an extension for your own music player you must implement another instance of the PlaybackService interface that knows how to control your own music player. This new class should then be added to the MediaPlayerAdapter and MusicRemotePreference in a similar way as the existing services. For more details on how to add support for your music player, see the SmartWatch extensions open source code.
Develop your own game based on the 8 Game extension
The 8 Game extension is a simple puzzle game for SmartWatch. The purpose of the game is to reorder the tiles on the screen until you see the full image. You can either use an image on the phone, or use tiles with numbers. To move a tile, you press it, or swipe it in the direction you want to move it. Once the tiles are in the correct order, you can choose to share the results by e-mail, SMS text message or through a social media app. If you long press during the game, it will bring up a menu where you can start a new game.
How to download and import projects into Eclipse
To use the Music player and 8 Game extensions, you need to download our Sony Add-on SDK. Both these extensions are built using the Smart Extension API, and the helper classes from the Smart Extension Utils, which are part of the Sony Add-on SDK. The Smart Extension API and the Smart Extension Utils are two separate Android library projects that must be imported into Eclipse to be able to build the extensions.
How to import the Smart Extension API into Eclipse:
- Install the Sony Add-on SDK.
- In Eclipse, click File > New > Project… > Android > Android Sample Project > Sony Add-on SDK and select SmartExtension > SmartExtensionAPI. Set the project name to SmartExtensionAPI.
- Click File > New > Project… > Android > Android Sample Project > Sony Add-on SDK and select SmartExtension > SmartExtensionUtils. Set the project name to SmartExtensionUtils.
How to import the extensions into Eclipse:
- Download the SmartWatch extensions.
- Extract the extensions to the same folder as the SDK.
- In Eclipse, click File > New > Project… > Android > Android Project > Android Project from Existing Code and select the MusicExtension or the EightPuzzleExtension depending on which project you want to use.
Learn more about SmartWatch at AnDevCon
Are you are attending AnDevCon later this month? Take the opportunity to learn more about developing for SmartWatch! In the session ”SmartWatch Development 101: Transforming the Mobile User Experience Through Sony Smart Accessories”, Magnus Helgstrand from Sony Mobile will teach you more about developing SmartWatch extensions and give some useful code samples.
We hope these apps will inspire you to extend your apps to work for SmartWatch. Or maybe you have already started extending your apps to SmartWatch? Are there any other Smart Extensions you would like to see open sourced? We are eager to hear your opinion and happy to answer any questions, so drop us a comment below!