SmartWatch2_SW2_PIU_04_R2

How to create an app extension for Sony SmartWatch 2

With a SmartWatch 2 extension, your users can utilise the features of your app without even picking their smartphone or tablet up from their bag or pocket. At the same time, you can get a lot of extra visibility for your app, since it will be exposed to all users of the SmartWatch 2. So are you ready to develop a new app extension or extend your existing app to support the Sony SmartWatch 2? We’ve put together a quick tutorial that shows you from start to finish, what programs you need, files you should use, and tools you can make use of, and the steps involved in creating your own app extension for Sony SmartWatch 2. Read more after the jump. (Updated 12 Nov, 2013)

If you’re new to creating app extensions for Sony SmartWatch 2, the following steps will walk you through everything you need to know to get you up and running with your app extension development.

How to get started in three steps

  1. Download and install the Android SDK. The Android™ SDK provides you with the API libraries and tools necessary to build, test, and debug apps for Android.
  2. Download and install the latest version of the Sony Add-on SDK from the Sony Add-on SDK installation page. The Sony Add-on SDK is an add-on to the Android SDK that includes the Smart Extension APIs.Those are easy to use, intent-based APIs that make it possible to access the display, notification, and other general controls on SmartWatch 2. The Sony Add-on SDK comes with full code examples for Smart Extension APIs, an emulator, and API references.
  3. In the Sony Add-on SDK package, go to the samples > SmartExtensions folder, and select the Smart Extension API sample application that is most relevant to your app extension.
Sample Smart Extension APIs included with the Sony Add-on SDK package.

Sample Smart Extension APIs included with the Sony Add-on SDK package.

How to create your Smart Extension in Eclipse
Create the Smart Extension API sample application using Eclipse. For example, here’s how to create a Notification API sample application using the SampleNotificationExtension:

  1. Start Eclipse and navigate to: File > New > Other.
  2. Expand the Android directory, then select Android Sample Project.
  3. In the Select Build Target option, select Sony Add-On SDK 2.0.
  4. Click Next to create the sample application. In the Select Sample dialog box, select an appropriate sample based on the purpose of your application, for example, “SampleNotificationExtension”. Also enter the appropriate sample names here, making sure to name the sample accordingly, so that you know what the sample is for.
  5. Click Finish. Your project should now be created in the Package Explorer of the Eclipse. Note: The first two sample codes that should be imported are SmartExtensionAPI and SmartExtensionUtils. All other Smart Extension sample codes will need these library projects.

In addition, you also have the API references available online to provide you with the details and capabilities of the Smart Extension APIs.

How to run the application on SmartWatch 2
To run the sample application on SmartWatch, follow the steps below:

  1. Make sure the Android smartphone or tablet is connected and paired with SmartWatch 2.
  2. Connect the Android smartphone or tablet with the machine using USB.
  3. Make sure Android Debug Bridge (adb) is running and the device can be detected. You can download adb from the Android SDK main page.
  4. You can now directly run the Smart Extension code example in Eclipse on a selected device using Run > Run As and then selecting the device.
  5. The Smart Extension code example will install on the device and should also be visible on the accessory.

How to use the Accessory Emulator
To run the Accessory Emulator on an Android smartphone or tablet, follow the steps below:

  1. Download Smart Connect from Google Play™ and get the accessory_emulator.apk from the Sony Add-on SDK package, then install them on the smartphone using adb. Note: Smart Connect is already installed if you are using a Sony Xperia™ smartphone or tablet.
  2. Connect the Android smartphone or tablet with the machine using USB.
  3. You can now directly run the Smart Extension code example in Eclipse on a selected device using Run > Run As and then select the device.
  4. The Smart Extension code example will install on the device, and should also be visible on the Accessory Emulator application.
  5. Open the Accessory Emulator app from the app tray. For more information on the emulator, refer to the Accessory Emulator section in the How to use the Smart Extension APIs document.

Distribute your app and get valuable exposure
Create an APK file to publish on Google Play™. To make your app show up in the pre-defined Google Play™ search, just make sure the Google Play™ description for your app includes the following string (we recommend at the bottom, on its own line):

Smart Connect extension for SmartWatch 2

***

We hope you find this guide helpful for creating apps for SmartWatch 2. If you have any questions, feel free to drop us a line in the comments field below, and we’ll be happy to get back to you with an answer as soon as we can.

More information

Comments 30

Sort by: Newest | Oldest | Most popular

  1. By Roy Yokoyama

    #1

    Sony Smartwatch 2 is great. I recommend another feature for the watchface.
    Pebble can switch the watchface easily by pressing or buttons on the side of watch.
    It will be great if the SmartWatch 2 can switch the watchface by pressing the button and bring up a menu to switch the installed watchfaces. (Currently, we need to go to Settings->Watch faces to select the desired watchface.) Basically, the pressing the menu button in the watchface screen bring up the Watch faces selection)

    • By Joe Padre

      #2

      Hi Roy,
      Thanks for your feedback. We’ll pass on your suggestion to the SmartWatch 2 development team.
      Best regards,
      Joe from Developer World

  2. By kunal mehta

    #3

    Hi. I wanted to show a custom layout when the watch is locked simile like watch faces application. can you give me some guidance on that from where to start.

  3. By Kolja Kieslich

    #5

    Can you please update this post? Even after an OS reinstall i’m getting the same errors. After importing SamplePreferenceActivity i get alot of: Control cannot be resolved to a variable, R cannot be resolved to a variable, mContext cannot be resolved to a variable, Extension cannot be resolved to a variable, etc.

  4. By Marius Vosylius

    #6

    Is it possible to create new activity that would trigger on onMenuItemSelected?

    • By Marlin L

      #7

      Yes, you can start an Activity the same way you would from any standard Android app.

  5. By Sagar Devanga

    #8

    I am getting an error when i try to run the sample control extensions

    Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE
    [2014-02-14 12:56:11 - SampleControlExtension] Please check logcat output for more details.

    what could be the solution

    • By Joe Padre

      #9

      Hi Sagar,
      Usually that error means that one already has an older version installed that is incompatible. Try uninstalling the old version and then install the new version and it should work.
      Best regards,
      Joe from Developer World

  6. By PJ Olson

    #10

    How do I remove this application from my SmartWatch?

    • By Joe Padre

      #11

      Hi PJ,
      To remove an app from your SmartWatch, just uninstall the app from your device, and it will be removed from your SmartWatch as well.
      Best regards,
      Joe from Developer World

      • By Marius Vosylius

        #12

        Hi Joe, Im not unable to remove Sample Notification app. There’s no option to do it.

        • By Joe Padre

          #13

          Hi Marius,
          From your device, try Settings -> Apps -> Downloaded -> SampleNotification -> Press uninstall.
          Best regards
          Joe from Developer World

          • By Marius Vosylius

            #14

            Thanks Joe, it did work fine. But another issue I have: Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE. This erros comes in then I have SampleApp, but my phone is clean.

          • By Joe Padre

            #15

            Hi Marius,
            try uninstalling, restarting the phone, and then installing.
            Best regards,
            Joe from Developer World

  7. By Jarl Wijman

    #16

    what be really be great is if Sony would respond to customer concerns, on their forum and community site.
    i see hardly any responses from Sony, this really worries me

    concerning the Smartwatch 2, it really needs more watch faces, or a way we can create our own, and a selectable screen timeout

    • By Joe Padre

      #17

      Hi Jarl,
      Thanks for taking the time to share your feedback on SmartWatch 2. We will forward your suggestions to the HW/SW teams responsible for SmartWatch 2 development.
      Sincerely,
      Joe from Developer World

      • By Leo Wandersleb

        #18

        So the question and reply regarding watchfaces imply there is no way we can create watchfaces? I’m slightly shocked and I’m interested to hear what the hw/sw guys have to say, too.

        • By Joe Padre

          #19

          Hi Leo,
          The functionality to create watch faces is not available at the moment, but the teams working on the product are looking into this.
          Best regards,
          Joe from Developer World

  8. By Cyma Real

    #20

    i am stuck in the step:- “How to create your Smart Extension in Eclipse” step 4

    in the select Sample dialog box, i do not see “Add Link to API overview – Notification”.
    which one should i pick up?

    Since then, i get lost, i do not know what to do about the imported “SmartExtensionAPI” and “SmartExtensionUtils”.

    • By Joe Padre

      #21

      Hi Cyma,
      For that step, the example should be: ‘SampleNotificationExtension’.
      Hope that helps. Please let us know if you need any other help with creating your extension.
      Best regards,
      Joe from Developer World

  9. By Edward De Jong

    #22

    I am familiar with the ipod Nano, which had a few hard-coded apps. Is the smartwatch 2 capable of launching an app from the watch itself? or does the mothership phone have to be powered on, and nearby, in order to run? Does this device only run in a tethered mode therefore? Can one load an app from a PC or Mac into the phone directly, like you can into an iPod touch with a USB cable or wifi, or does this device only connect to an android phone? Seems like Sony needs to be a lot clearer about how this device gets and runs software. I have made over 70 iphone/android apps and am very interested in the watch market, but for the ecosystem to really take off you have to have an easy way of getting software. The samsung watch seems DOA to me, it requires specific samsung devices to load the watch, which is a disastrous mistake.

  10. By Jarl Wijman

    #23

    can i also use this sdk to create new watch faces for the Smartwatch 2?

  11. By Andy Aspell-Clark

    #24

    So, I’ve finally worked this out.

    Once you have created the “SmartExtensionAPI” sample project:
    1. open it’s properties and mark it as a library.

    Now create the “SmartExtensionUtils” sample and open it’s properties.
    1. mark it as a library
    2. add the SmartExtensionAPI as a library for the Utils project.

    now it compiles :)

    • By Joe Padre

      #25

      Hello Andy,
      Glad to hear it compiles now. :) Let us know if anything else comes up. By the way, which one of your apps are you planning to extend to SmartWatch 2?
      Cheers,
      Joe from Developer World

      • By Andy Aspell-Clark

        #26

        The first projects I am going to extend are my training plan viewer and contact lens tracker.

        I’m also going to see if I can find some uses at work with my apps.

  12. By Andy Aspell-Clark

    #27

    Nope.
    Even re-doing all the steps after uninstalling SDK 1.0, and re-creating the sample projects I still get the same error.

  13. By Andy Aspell-Clark

    #28

    Opps, just noticed that because I was eager and installed the Sony add-on SDK a few weeks ago, I had not installed the Sony Add-On SDK 2.0 (only 1.0), installing now to see if that fixes my errors.

  14. By Andy Aspell-Clark

    #29

    I’ve tried to follow the instructions on this page but I get the following error (on SmartExtensionUtils project):

    com.sonyericsson.extras.liveware.aef cannot be resolved to a variable AccessorySensorManager.java /SonySW-SmartExtensionUtils/src/com/sonyericsson/extras/liveware/extension/util/sensor line 124 Java Problem

    any idea how to fix this??

    • By Larry Aasen

      #30

      I resolved this issue by adding the SmartExtensionAPI in SmartExtensionUtils project in Properties > Android > Library section > Add…

1-30 of 30 comments.