Top Banner
First steps with the Tizen™ Wearable SDK Bartosz Skorupski, Software Engineer, Samsung Electronics
28

First steps with the Tizen Wearable SDK

Aug 17, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: First steps with the Tizen Wearable SDK

First steps with the Tizen™ Wearable SDK Bartosz Skorupski, Software Engineer, Samsung Electronics

Page 2: First steps with the Tizen Wearable SDK

Gear’s family

Page 3: First steps with the Tizen Wearable SDK

Supported API

Category API

HTML5 W3C / HTML5

Supplementary

Device Device

Samsung Gear SAP

Motion

Sensor

Badge

Camera

IrLED

Page 4: First steps with the Tizen Wearable SDK

Device API

Category API

Application Alarm

Application

Package

Communication IrLED

SAP

Content Content

Download

UI Badge

Page 5: First steps with the Tizen Wearable SDK

Device API

Category API

IO Filesystem

Message Port

System Motion

Power

Sensor

System Info

System Settings

Time

Page 6: First steps with the Tizen Wearable SDK

TAU (Tizen Advanced UI Framework)

• Fast start-up time (Pre-building HTML5 widgets) • Common API for different devices and profiles • Code optimization • Complete WebKit support • Backward compatibility for deprecated API

Page 7: First steps with the Tizen Wearable SDK

Application model

Host Application

Linked (Master-Follower)

Linked (Master) Linked (Follower)

Provider

Consumer

Host-side

Wearable-side

Gear Application

Integrated

Provider

Consumer

Host-side

Wearable-side

Gear Application

Host Application Hos

t W

eara

ble

Standalone

Wearable-side

Gear Application

Widget

Page 8: First steps with the Tizen Wearable SDK

Architecture Gear device

SAP WebAPI

Page 9: First steps with the Tizen Wearable SDK

SDK Emulator

• Screen resolutions support • 320x320 Gear 1, Gear 2, Gear 2 Neo • 360x480 Gear S

• Control Panel Managers • Device • App

Page 10: First steps with the Tizen Wearable SDK

Application Development

• Requirements • Samsung Account (sign up at http://developer.samsung.com) • Tizen SDK for Wearable

• Connect real device to IDE or use Emulator • Create first application (template or sample apps)

Page 11: First steps with the Tizen Wearable SDK

Acquiring a certificate

• Sign up or create an account on http://developer.samsung.com • Request certificates for Author and Device

• New certificate • Based on existing certificate • Based on existing Android Certificate

Page 12: First steps with the Tizen Wearable SDK

Security Profile

• Get DUID (Device Unique Identifier)

Page 13: First steps with the Tizen Wearable SDK

Apply certificate to Security Profile

Page 14: First steps with the Tizen Wearable SDK

SAP requirements add privilege in config.xml

• Wearable / Gear device

• Mobile / Android

<tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>

<tizen:privilege name="http://developer.samsung.com/tizen/privilege/accessoryprotocol"/>

Page 15: First steps with the Tizen Wearable SDK

Consumer and Provider roles accessoryservices.xml

• Define roles

• Link service profile

<resources> <application name = "myApplication"> <serviceProfile role = "consumer" name = "myApplication" id = "/system/myApp" version = "2.0" serviceLimit = "ONE_PEERAGENT" serviceTimeout = "30"> <supportedTransports> <transport type = "TRANSPORT_BT"/> </supportedTransports> <serviceChannel id = "100" dataRate = "high" priority = "low" reliability = "enable"/> </serviceProfile> </application> </resources>

<tizen:metadata key="AccessoryServicesLocation" value="sap.xml"/>

Page 16: First steps with the Tizen Wearable SDK

Application Types

• Watchface Clock Widget

• Watch Application

<tizen:category name="com.samsung.wmanager.WATCH_CLOCK"/>

Page 17: First steps with the Tizen Wearable SDK

Time API

var date = tizen.time.getCurrentDateTime(); // instead of new Date() var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); console.log(hours + ":" + minutes + ":" + seconds); var changeCallback = function() { var currentDateTime = tizen.time.getCurrentDateTime(); console.log(currentDateTime.toLocalString()); }; tizen.time.setDateTimeChangeListener(changedCallback); // tizen.time.unsetDateTimeChangeListener();

Page 18: First steps with the Tizen Wearable SDK

Power API

Resource State

SCREEN SCREEN_OFF SCREEN_DIM

SCREEN_NORMAL

CPU CPU_AWAKE

tizen.power.request(resource, state); tizen.power.release(resource);

Page 19: First steps with the Tizen Wearable SDK

SystemInfo API

Property

DISPLAY DEVICE_ORIENTATION BUILD

LOCALE NETWORK WIFI_NETWORK

CELLULAR_NETWORK SIM PERIPHERAL

MEMORY

tizen.systeminfo.getPropertyValue(property, successCallback, errorCallback); var listenerId = tizen.systeminfo.addPropertyValueChangeListener(property, successCallback, options); tizen.systeminfo.removePropertyValueChangeListener(listenerId);

Page 20: First steps with the Tizen Wearable SDK

Application API

// all installed applications tizen.application.getAppsInfo(onSuccess, onError); // details about Calendar application var appInfo = tizen.application.getAppInfo("com.samsung.w-calendar2"); // all running applications tizen.application.getAppsContext(onSuccess, onError); // current application context var appContext = tizen.application.getAppContext(null);

Page 21: First steps with the Tizen Wearable SDK

Application API

// launch an application tizen.application.launch("com.samsung.w-calendar2", onSuccess, onError); // run an application to choose image files var onAppReply = { onsuccess: function(data) { for (var i = 0; i < data.length; i++) { if (data[i].key === "http://tizen.org/appcontrol/data/selected") { console.log("Selected image: " + data[i].value[0]); } } }, onfailure: function() { console.log("The launch application control failed"); }, } var appControl = new tizen.ApplicationControl( "http://tizen.org/appcontrol/operation/pick", // operation null, // URI "image/jpeg", // mime null); // category ); tizen.application.launchAppControl(appControl, null, onSuccess, onError, onAutoReply);

Page 22: First steps with the Tizen Wearable SDK

Development on real device

• Connect Android device to PC via Bluetooth • Debugging by Remote (Web) Inspector

Page 23: First steps with the Tizen Wearable SDK

Working with SDK Emulator

1. Uninstall Samsung Gear Manager from mobile device 2. Download and unzip Applications_for_Emulator.zip 3. Install the following APKs on mobile device:

• SAaccessoryService_Emul.apk • SAFTCore_Emul.apk • HostManagerForEmul.apk

4. Run an app HostManagerForEmul on mobile device

Page 24: First steps with the Tizen Wearable SDK

Connecting Host with SDK Emulator

Requirements 1. ADT, adb and set a path to adb*

export PATH=${PATH}:~/adt-bundle/sdk/platform-tools adb devices

2. Tizen SDK for Wearable 3. Type commands in terminal

adb –d forward tcp:8230 tcp:8230 4. Run an app HostManagerForEmul 5. Run SDK Emulator * Make sure USB debugging mode is turned on

Page 25: First steps with the Tizen Wearable SDK

Removing an app from SDK Emulator

• Set a path to sdb, and make sure it’s properly set export PATH=${PATH}:~/tizen-wearable-sdk/tools sdb devices

• Type the following command in terminal sdb uninstall [appid] i.e. VbsgE6bms2

Page 26: First steps with the Tizen Wearable SDK

References (1/2)

• Samsung Accessory SDK • http://developer.samsung.com/galaxy#accessory • http://developer.samsung.com/resources/accessory

• Tutorials • Developing an app on Samsung Gear devices • Testing an app on Tizen Wearable SDK Emulator • Samsung Galaxy App Store

Page 27: First steps with the Tizen Wearable SDK

References (2/2)

• Guides and API references • Hello Accessory Developer’s Guide • Development Guide • Design responsive apps on Tizen wearable devices • SAP API reference • UI Design Guidelines for Gear S devices • Source Code Samples

Page 28: First steps with the Tizen Wearable SDK

@bskorupski [email protected]