How to Install (sideload) .wgt app files on the Samsung Gear 2 smartwatch using SDB

sdb

This posts discusses the steps required to install a third party wearable widget (.wgt) as a standalone app  on the Samsung Gear 2 smart-watch or an emulator. It is assumed that you are the developer of the .wgt file and would like to be able to install /test it directly on your device without having to go through the app store.

About  Smart Development Bridge (SDB).

For those with existing experience developing android apps, SDB is very similar to the Android Debug Bridge (ADB). Smart Development Bridge (SDB) is a command line tool for emulator/device management. It acts as an intermediary between a device and your development system and provides various device management capabilities such as moving and syncing files to the emulator, running a UNIX shell on the device or emulator. Using SDB tool you can: Manage connections to multiple instances of emulator/devices. You can list connected devices and send a command to a specific device with a serial number that is created by the SDB. Supply basic commands for application development, such as file transfer, remote shell command, port forwarding for a debugger, and viewing, filtering, and controlling device log output, and troubleshooting.

See : Step by Step Guide on How to Build Your First Gear 2 App.

When you install the tizen wearable sdk, it automatically installs SDB (in the tools folder) . You can use sdb using the windows command line interface. SDB commands are of the form

$ sdb [option] <command> [parameters]

Where [option] can be:
-d: Directs the command to the only connected USB device and return an error if more than one USB device is present.
-e: Direct the command to the only running Emulator and return an error if more than one Emulator is present.
-s <serial number>: Direct the command to the USB device or Emulator with the defined serial number. If multiple Emulator or device instances are running, you need to specify a target instance in the SDB command.

To install a wgt file , the following steps can be followed.

Ensure You have the right Certificates

The wearable SDK help files contains a detailed guide on how to generate a signing certificate request. You can find it by going to help

Getting Started with Tizen Wearable > Development Environment > Tizen SDK for Wearable > Certificates > Sending a Certificate Request

Along this process, you will be asked to input the Device Unique ID (DUID) for the device you will be testing on. You can add both the DUID for your emulator and the DUID for your test gear 2 device.

To get the DUID for your gear 2 device ..

  1. Connect your device to your host computer or launch the Emulator.
  2. In the Connection Explorer, check that the connected device or Emulator is visible.
  3. Select the device or Emulator, and click Properties.The DUID is visible on the Info panel.

After you get this certificate registered, you should import it into your workspace and ensure its used to sign the .wgt file which you would like to sideload into your gear device. If the DUID of the gear device is not included in your certificate, an INVALID_SIGNATURE error would occur .

Also, if you are installing a wgt on a gear device for the first time, (ie no apps have been deployed from your wearable ide to the device previously) , perform the following steps if you keep getting the invalid_signature error above:

  1. In the Connection Explorer, select the /home/developer folder.
  2. Copy the certificate-registration.xml file containing the DUID of the target device to the /home/developer folder of the Wearable device.

Enable USB Debugging on Your Gear 2 Device and Connect it to Your

If you are using a physical gear 2 device, USB debugging needs to be enabled. On your gear 2
– Go to Settings by swiping to the right from the home screen
– Scroll to the last option named “Gear info”
You should be able to see two option now – About Gear and USB Debugging.
– Tap on USB Debugging and you would be seeing a warning, which warns you about the danger of enabling usb debugging. Do it anyway.

Copy your .wgt file to the SDB Folder.

– Locate your installation folder for your tizen sdk.
– Locate the tools directory inside it .  For me , this folder was D:\tizen\tizen-wearable-sdk\tools
– You should see sdb.exe inside this folder
– Now copy your wgt file (xxx.wgt) to this folder

Ensure your Gear 2 device or Emulator is connected.

– Open command line (cmd on windows) and navigate to the tools folder.
– On the console type : sdb devices
This should list all your connected devices and emulator. If you have your real gear 2 connected via usb it should also show up here. It it doesnt, ensure all the necessary drivers are installed. Sometimes a re-installation of the gear 2 device may be helpful too.

Install the widget

On the console, type : sdb install xxx.wgt.
This should install the .wgt file on your connected device.

Using Gear Manager.

You can also install your .wgt files using gear manager. Following the integrated and linked type of gear 2 apps, the goal is to include the widget inside a host side apk which deployed to the gear 2 device when the apk is installed.

– Add the wgt file to the assets folder of your android project,
– Build and apk and install this apk on a connected samsung device through gear manager.
The wgt file will be automatically installed on a connected android wear device

About Vykthur

Mobile and Web App Developer and Researcher. Passionate about learning, teaching, and recently - writing.
This entry was posted in Tutorials, Wearables and tagged , , , , . Bookmark the permalink.
  • feorlen

    I only get “Unknown Error [42] failed” when I try to install my file with sdb. Some internet searching suggests this is a code signing error, except I had to create and add the certs to get my app to build so I have already been through the instructions to do that. Is there something else? I’m trying to install the very first HelloAccessoryConsumer to see that I can write apps, and I’m not able to get past even that.

    • Vykthur

      Yeap .. you should definitely use the right certificates to sign your app. Improtantly the DUID of the test devices should be included in your cert generation process.

      -V

  • Jose

    I tried it on win8 and ubuntu 14 and it didn’t recognize my gear 2, any ideas?
    I’ve connected it by usb and it only recognized my emulator with sdb devices, I followed all steps.

    • Vykthur

      Have you installed the samsung drivers, and enabled debugging on the gear ?

  • Sakura

    Even after getting the certificate for the real device i am not able to install the app in my watch directly from the tizen sdk.
    Things we have done:
    1.Generated certificate twice
    2.Tried to run in TIzen as well as in cmd prompt using sdb
    3.We keep getting the Error:Sign Invalid.

  • rauschtime

    can someone post the link with the certificates? beacuse i cant find them …

  • Amir Meshkin

    It would be amazing if someone could help me do this on a Samsung Gear S.

    The large rectangular watch i probably should of never bought.

  • Joms

    Copy the certificate-registration.xml file containing the DUID of the target device to the /home/developer folder of the Wearable device.

    Where the hell is this certificate-registration.xml file located? =D
    I already created a certificate (with DUID) and it just created PFX file