0

I would like to display the output (a bitmap) of my existing App XYZ on my Smartwatch. I understand, that the Control API is the way to go, but the existing examples from the Sony SDK and the OpenSource projects (8Game and MusicPlayer) aren't clear to me. Am I right in the assumption, that I need following classes integrated into my existing App?

  • MyControlWatch.java
  • MyExtensionReceiver.java
  • MyExtensionService.java
  • MyRegistrationInformation.java

What else do I need and how do I get the SmartWatch to display my bitmap? Do I have to send a CONTROL_START_REQUEST_INTENT and, if yes, from where should I do that? What do I have to change from the given SampleControlExtension to get my result?

2 Answers2

1

Yes, those are the classes you will need to display your Control Extension. You don't need to send CONTROL_START_REQUEST_INTENT necessarily. That is only if you want to start your Control Extension from another extension.

Look in the sample code in the SampleControlSmartWatch.java class included in the /samples directory of the SDK. Check the Animation() class constructor for an example. Essentially you need to create a layout then add your bitmap then call showBitmap().

mldeveloper
  • 2,253
  • 1
  • 13
  • 14
0

Sony should create mini tutorials as usable for things like this u.u

/** * This is an example of how to update the entire layout and some of the * views. For each view, a bundle is used. This bundle must have the layout * reference, i.e. the view ID and the content to be used. This method * updates an ImageView and a TextView. * * @see Control.Intents#EXTRA_DATA_XML_LAYOUT * @see Registration.LayoutSupport */

private void updateLayout() {
    mCount = 0;
    mIconImage = true;

    String caption = mContext.getString(R.string.text_tap_to_update);

    // Prepare a bundle to update the button text.
    Bundle bundle1 = new Bundle();
    bundle1.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.btn_update_this);
    bundle1.putString(Control.Intents.EXTRA_TEXT, caption);

    // Prepare a bundle to update the ImageView image.
    Bundle bundle2 = new Bundle();
    bundle2.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.image);
    bundle2.putString(Control.Intents.EXTRA_DATA_URI,
            ExtensionUtils.getUriString(mContext, R.drawable.icon_extension48));

    Bundle[] bundleData = new Bundle[2];
    bundleData[0] = bundle1;
    bundleData[1] = bundle2;

    showLayout(R.layout.layout, bundleData);
}
fmgh
  • 168
  • 4
  • 14