First steps with the Tizen Wearable SDK
-
Upload
bartosz-skorupski -
Category
Documents
-
view
139 -
download
7
Transcript of First steps with the Tizen Wearable SDK
First steps with the Tizen™ Wearable SDK Bartosz Skorupski, Software Engineer, Samsung Electronics
Gear’s family
Supported API
Category API
HTML5 W3C / HTML5
Supplementary
Device Device
Samsung Gear SAP
Motion
Sensor
Badge
Camera
IrLED
Device API
Category API
Application Alarm
Application
Package
Communication IrLED
SAP
Content Content
Download
UI Badge
Device API
Category API
IO Filesystem
Message Port
System Motion
Power
Sensor
System Info
System Settings
Time
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
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
Architecture Gear device
SAP WebAPI
SDK Emulator
• Screen resolutions support • 320x320 Gear 1, Gear 2, Gear 2 Neo • 360x480 Gear S
• Control Panel Managers • Device • App
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)
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
Security Profile
• Get DUID (Device Unique Identifier)
Apply certificate to Security Profile
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"/>
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"/>
Application Types
• Watchface Clock Widget
• Watch Application
<tizen:category name="com.samsung.wmanager.WATCH_CLOCK"/>
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();
Power API
Resource State
SCREEN SCREEN_OFF SCREEN_DIM
SCREEN_NORMAL
CPU CPU_AWAKE
tizen.power.request(resource, state); tizen.power.release(resource);
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);
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);
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);
Development on real device
• Connect Android device to PC via Bluetooth • Debugging by Remote (Web) Inspector
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
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
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
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
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
@bskorupski [email protected]