Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Filter
FAQ health
docfaq what are the main features of the samsung health sensor sdk? the main features of the samsung health sensor sdk include track raw and processed health sensor data on galaxy watch receive data from multiple health sensors for information about the available trackers, see what data is provided the continuous health tracker types are accelerometer heart rate photoplethysmogram ppg skin temperature continuous tracker types measured sensor data and periodically invokes a tracking event listener this enables the watch’s sensor data to be tracked continuously and provide more granular results while conserving battery life how do i get access to the samsung health sensor sdk? you can download the samsung health sensor sdk on the samsung developer site and develop your application and develop the application with enabling the health platform's developer mode to distribute your application using the samsung health sensor sdk, request for the samsung partner program when your request is reviewed, you receive information about how to access the sdk content for more information, see process does the samsung health sensor sdk work on android phones? no the samsung health sensor sdk supports only galaxy watch4 and later models running wear os powered by samsung it does not support other mobile devices, such as smartphones can supported health tracker types of the samsung health sensor sdk differ depending on the galaxy watch model or wear os version? yes the supported health tracker types can differ depending on the specific galaxy watch model and the watch software version the samsung health sensor sdk provides a capability check api it retrieves which tracker types are available on the user’s watch and can therefore be used by your application why do i get an sdk_policy_error when using samsung health sensor sdk? this error occurs when your app's package name or sha-256 signature does not match the information registered with samsung to use samsung health sensor sdk in a publicly distributed app, you must register your app by submitting a partnership request and providing the correct package name and sha-256 signature if the app is not registered or the information does not match, the sdk will return a policy error during development, you can use the sdk without registration by enabling the developer mode for more details, refer to app verification can i read data from more than 1 health tracker type simultaneously? yes, depending on the tracker type there are 2 tracker types on-demand tracker type, such as bia body composition and ecg electrocardiogram continuous tracker type, such as accelerometer and heart rate only 1 on-demand tracker type can be used at a time multiple continuous tracker types can be used simultaneously the measure blood oxygen level and heart rate on galaxy watch code lab demonstrates how to implement running on-demand and continuous tracker types is an emulator available for developing applications with the samsung health sensor sdk? no the samsung health sensor sdk doesn't support the emulator development with the sdk requires the galaxy watch device can i detect when users take the galaxy watch off their wrist? yes, depending on the tracker for the heart rate, spo2, bia body composition , and sweat loss trackers, you can use the samsung health sensor sdk to monitor the status field with the update listener for example, a heart rate status value of “-3” means that the wearable is not being worn for information about other status values and trackers, refer to the api reference alternatively, you can check the sensor type_low_latency_offbody_detect value for more information, see heart rate tracking with the off-body sensor does the samsung health sensor sdk receive its data through samsung health? no the samsung health sensor sdk does not share data with samsung health health services also provides heart rate tracking how is heart rate tracking with the samsung health sensor sdk different? the samsung health sensor sdk provides heart rate data tracking with ibi inter-beat interval , which can be used to calculate hrv heart rate variability this information can be used for more detailed analysis the android sensor manager also provides accelerometer tracking how is accelerometer tracking with the samsung health sensor sdk different? the accelerometer tracking provided by the samsung health sensor sdk records data samples with 25hz resolution continuously the sdk gathers sensor data in an application processor without waking up the cpu and sends an event at specific periods to a watch application this minimizes the watch's battery consumption and enables a watch application to track the user's status for the entire day
Learn Code Lab
codelabtransfer heart rate data from galaxy watch to a mobile device objective create a health app for galaxy watch, operating on wear os powered by samsung, to measure heart rate and inter-beat interval ibi , send data to a paired android phone, and create an android application for receiving data sent from a paired galaxy watch overview with this code lab, you can measure various health data using samsung health sensor sdk and send it to a paired android mobile device for further processing samsung health sensor sdk tracks various health data, but it cannot save or send collected results meanwhile, wearable data layer allows you to synchronize data from your galaxy watch to an android mobile device using a paired mobile device allows the data to be more organized by taking advantage of a bigger screen and better performance see samsung health sensor sdk descriptions for detailed information set up your environment you will need the following galaxy watch4 or newer android mobile device android studio latest version recommended java se development kit jdk 17 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! heart rate data transfer sample code 218 3 kb connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that the wi-fi is enabled from the list of available wi-fi networks, choose and connect to the same one as your pc turn on developer mode and adjust its settings on your watch, go to settings > about watch > software and tap on software version 5 times upon successful activation of developer mode, a toast message displays as on the image below afterwards, developer options is going to be visible under settings tap developer options and enable the following options adb debugging in developer options find wireless debugging turn on wireless debugging check always allow on this network and tap allow go back to developer options and click turn off automatic wi-fi notethere may be differences in settings depending on your one ui version connect your galaxy watch to android studio go to settings > developer options > wireless debugging and choose pair new device take note of the wi-fi pairing code, ip address & port in android studio, go to terminal and type adb pair <ip address> <port> <wi-fi pairing code> when prompted, tap always allow from this computer to allow debugging after successfully pairing, type adb connect <ip address of your watch> <port> upon successful connection, you can see the following message in the terminal connected to <ip address of your watch> now, you can run the app directly on your watch turn on developer mode for health platform swipe down from the top of the screen to open the quick panel, then tap the settings icon scroll down and tap apps select health platform quckly tap health platform for about 10 times developer mode is enabled when [dev mode] appears below health platform noteyou can disable developer mode by quickly tapping the health platform until [dev mode] disappears set up your android device click on the following links to setup your android device enable developer options run apps on a hardware device connect the galaxy watch with you samsung mobile phone start your project in android studio, click open to open an existing project locate the downloaded android project hrdatatransfer-code-lab from the directory and click ok you should see both devices and applications available in android studio as in the screenshots below initiate heart rate tracking noteyou may refer to this blog post for more detailed analysis of the heart rate tracking using samsung health sensor sdk first, you need to connect to the healthtrackingservice to do that create connectionlistener, create healthtrackingservice object by invoking healthtrackingservice connectionlistener, context invoke healthtrackingservice connectservice when connected to the health tracking service, check the tracking capability the available trackers may vary depending on samsung health sensor sdk, health platform versions or watch hardware version use the gettrackingcapability function of the healthtrackingservice object obtain heart rate tracker object using the function healthtrackingservice gethealthtracker healthtrackertype heart_rate_continuous define event listener healthtracker trackereventlistener, where the heart rate values are collected start tracking the tracker starts collecting heart rate data when healthtracker seteventlistener updatelistener is invoked, using the event listener collect heart data from the watch the updatelistener collects datapoint instances from the watch, which contains a collection of valuekey objects those objects contain heart rate, ibi values, and ibi statuses there's always one value for heart rate while the number of ibi values vary from 0-4 both ibi value and ibi status lists have the same size go to wear > java > data > com samsung health hrdatatransfer > data under ibidataparsing kt, provide the implementation for the function below /******************************************************************************* * [practice 1] get list of valid inter-beat interval values from a datapoint * - return arraylist<int> of valid ibi values validibilist * - if no ibi value is valid, return an empty arraylist * * var ibivalues is a list representing ibivalues up to 4 * var ibistatuses is a list of their statuses has the same size as ibivalues ------------------------------------------------------------------------------- * - hints * use local function isibivalid status, value to check validity of ibi * ****************************************************************************/ fun getvalidibilist datapoint datapoint arraylist<int> { val ibivalues = datapoint getvalue valuekey heartrateset ibi_list val ibistatuses = datapoint getvalue valuekey heartrateset ibi_status_list val validibilist = arraylist<int> //todo 1 return validibilist } check data sending capabilities for the watch once the heart rate tracker can collect data, set up the wearable data layer so it can send data to a paired android mobile device wearable data layer api provides data synchronization between wear os and android devices noteto know more about wearable data layer api, go here to determine if a remote mobile device is available, the wearable data layer api uses concept of capabilities not to be confused with samsung health sensor sdk’s tracking capabilities, providing information about available tracker types using the wearable data layer's capabilityclient, you can get information about nodes remote devices being able to consume messages from the watch go to wear > java > com samsung health hrdatatransfer > data in capabilityrepositoryimpl kt, and fill in the function below the purpose of this part is to filter all capabilities represented by allcapabilities argument by capability argument and return the set of nodes set<node> having this capability later on, we need those nodes to send the message to them /************************************************************************************** * [practice 2] check capabilities for reachable remote nodes devices * - return a set of node objects out of all capabilities represented by 2nd function * argument, having the capability represented by 1st function argument * - return empty set if no node has the capability -------------------------------------------------------------------------------------- * - hints * you might want to use filtervalues function on the given allcapabilities map * ***********************************************************************************/ override suspend fun getnodesforcapability capability string, allcapabilities map<node, set<string>> set<node> { //todo 2 } encode message for the watch before sending the results of the heart rate and ibi to the paired mobile device, you need to encode the message into a string for sending data to the paired mobile device we are using wearable data layer api’s messageclient object and its function sendmessage string nodeid, string path, byte[] message go to wear > java > com samsung health hrdatatransfer > domain in sendmessageusecase kt, fill in the function below and use json format to encode the list of results arraylist<trackeddata> into a string /*********************************************************************** * [practice 3] - encode heart rate & inter-beat interval into string * - encode function argument trackeddata into json format * - return the encoded string ----------------------------------------------------------------------- * - hint * use json encodetostring function **********************************************************************/ fun encodemessage trackeddata arraylist<trackeddata> string { //todo 3 } notetrackeddata is an object, containing data received from heart rate tracker’s single datapoint object @serializable data class trackeddata var hr int, var ibi arraylist<int> = arraylist run unit tests for your convenience, you can find an additional unit tests package this lets you verify your code changes even without using a physical watch or mobile device see the instruction below on how to run unit tests right-click on com samsung health hrdatatransfer test , and execute run 'tests in 'com samsung health hrdatatransfer" command if you have completed all the tasks correctly, you can see all the unit tests pass successfully run the app after building the apks, you can run the applications on your watch to measure heart rate and ibi values, and on your mobile device to collect the data from your watch once the app starts, allow the app to receive data from the body sensors afterwards, it shows the application's main screen to get the heart rate and ibi values, tap the start button tap the send button to send the data to your mobile device notethe watch keeps last ~40 values of heart rate and ibi you’re done! congratulations! you have successfully achieved the goal of this code lab now, you can create a health app on a watch to measure heart rate and ibi, and develop a mobile app that receives that health data! if you face any trouble, you may download this file heart rate data transfer complete code 217 8 kb to learn more about samsung health sensor sdk, visit developer samsung com/health/sensor
Develop Health
docheart rate tracking with the off-body sensor battery consumption is a critical factor when developing applications that use device sensors to prolong battery life, the samsung health sensor sdk allows you to implement batching trackers, which send multiple data points in a single callback event another way you can extend battery life is by stopping sensor tracking when it is not needed, such as when the watch is not being worn this blog describes the “hr tracker” sample application, which implements the batching heart rate tracker in combination with the off-body sensor the application enables heart rate tracking only when the watch is worn if the user tries to start tracking without wearing the watch, they are informed to put it on if the watch is removed during tracking, the tracking is stopped if you have a galaxy watch4 or higher device running wear os powered by samsung, you can download the sample application and test it on your device hr tracker v1 3 0 184 4 kb aug 20 , 2025 prerequisites to implement heart rate tracking in the application in the androidmanifest xml file for the application, declare the appropriate permissions depending on targetsdk of the application and android version of device that the application will run on - one of these two permissions will be used <uses-permission android name="android permission health read_heart_rate" /> <uses-permission android name="android permission body_sensors" /> in the heartrateactivity java application code file, check whether the user has granted appropriate permission on their galaxy watch if they have not, request it since the app may be started on device with either android 15, or android 16 - we must request proper permission the following code will check on which android version the code is executed on string permission; if build version sdk_int >= build version_codes baklava { permission = healthpermissions read_heart_rate; } else { permission = manifest permission body_sensors; } if checkselfpermission permission == packagemanager permission_denied { requestpermissions new string[]{permission}, 0 ; } keep in mind, that if your application targetsdk=35 then body_sensors permissions should always be used implementing on and off-body detection to detect when the galaxy watch is being worn on the wrist create an instance of the sensormanager class msensormanager = sensormanager getsystemservice sensor_service ; from the sensormanager class, create an instance of the sensor class that contains the low-latency off-body sensor offbodysensor = msensormanager getdefaultsensor sensor type_low_latency_offbody_detect ; in the onresume method, register an event listener for changes to the offbodysensor value when the application is in the foreground msensormanager registerlistener skintemperatureactivity this, offbodysensor, sensormanager sensor_delay_normal ; in the onpause method, unregister the event listener when the application is in the background msensormanager unregisterlistener this ; override the onsensorchanged method to react to the offbodydata sensor value change when the watch is worn or removed from the wrist because the sensor value is a float, you must convert the value to an integer final float offbodydatafloat = sensorevent values[0]; final int offbodydata = math round offbodydatafloat ; if the value of offbodydata is 1, the watch is being worn we set the variable, which describes worn status, to true deviceworn set true ; if the value of offbodydata is 0, the watch is not being worn set the status variable to false and if measurement was being done at that time - end it and notify the user deviceworn set false ; if ismeasurementrunning get { endmeasurement ; toast maketext this, r string device_removed_during_measurement, toast length_long show ; } in the sample application - a toast message is shown, if the watch is removed while tracker is working watch removed during measurement measuring the heart rate to measure the user’s heart rate check which trackers are supported on the watch using the checkcapabilities method final list<healthtrackertype> availabletrackers = healthtrackingservice gettrackingcapability getsupporthealthtrackertypes ; and return if the heart rate tracker is supported return availabletrackers contains healthtrackertype heart_rate_continuous ; initialize the heart rate tracker heartratetracker = healthtrackingservice gethealthtracker healthtrackertype heart_rate_continuous ; when "measure" button is pressed - check if watch is being worn before starting tracker and cancel execution if its not if !deviceworn get { toast maketext this, r string device_not_worn, toast length_short show ; return; } set an event listener to receive and handle the tracked heart rate data if !ishandlerrunning { heartratehandler post -> heartratetracker seteventlistener heartratelistener ; ishandlerrunning = true; } a listener is an object, which will process incoming data in this blog we will focus on one of the functions included in it - ondatareceived it contains data gathered by the samsung health sensor sdk as list of datapoint type public void ondatareceived @nonnull list<datapoint> list { for datapoint data list { updateheartrate data ; } } for the heart rate sensor, each tracking result consists of a heart rate reading in beats per minute and its status parameter, and a list of inter-beat intervals and the corresponding status for each value because we are interested in the heart rate, extract the beats per minute reading and status final int status = data getvalue valuekey heartrateset heart_rate_status ; int heartratevalue = data getvalue valuekey heartrateset heart_rate ; trackerdatasubject notifyheartratetrackerobservers status, heartratevalue ; if the heart rate reading was successful, the status value is “1” to interpret other status values, see the api documentation display the heart rate and status value on the application screen activityheartratebinding txtheartratebpmvalue settext string format locale getdefault , "%d", heartratevalue ; activityheartratebinding txtheartratestatusvalue settext string format locale getdefault , "%d", status ; "hr tracker" sample application ui if the measurement is stopped by either user input, or watch being removed - stop the heart rate tracker if heartratelistener != null { heartratelistener stoptracker ; } this demonstration has shown how you can combine multiple strategies to enhance battery life when implementing sensor tracking in your watch applications, such as using batching tracker, and to disable tracking when the user is not wearing the device we encourage you to try doing it by yourself and explore other available features provided by samsung health sensor sdk
Learn Code Lab
codelabmeasure blood oxygen level on galaxy watch objective create a health app for galaxy watch, operating on wear os powered by samsung, utilizing samsung health sensor sdk to trigger and obtain blood oxygen level spo2 measurement results overview samsung health sensor sdk provides means of accessing and tracking health information contained in the health data storage its tracking service gives raw and processed sensor data such as accelerometer and body composition data sent by the samsung bioactive sensor the latest bioactive sensor of galaxy watch runs powerful health sensors such as photoplethysmogram ppg , electrocardiogram ecg , bioelectrical impedance analysis bia , sweat loss, and spo2 see samsung health sensor sdk descriptions for detailed information set up your environment you will need the following galaxy watch4 or newer android studio latest version recommended java se development kit jdk 11 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! measuring blood oxygen level sample code 152 8 kb connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that wi-fi is enabled from the list of available wi-fi networks, choose and connect to the same one as your pc turn on developer mode and adjust its settings on your watch, go to settings > about watch > software and tap on software version 5 times upon successful activation of developer mode, a toast message displays as on the image below afterwards, developer options is going to be visible under settings tap developer options and enable the following options adb debugging in developer options find wireless debugging turn on wireless debugging check always allow on this network and tap allow go back to developer options and click turn off automatic wi-fi notethere may be differences in settings depending on your one ui version connect your galaxy watch to android studio go to settings > developer options > wireless debugging and choose pair new device take note of the wi-fi pairing code, ip address & port in android studio, go to terminal and type adb pair <ip address> <port> <wi-fi pairing code> when prompted, tap always allow from this computer to allow debugging after successfully pairing, type adb connect <ip address of your watch> <port> upon successful connection, you can see the following message in android studio’s terminal connected to <ip address of your watch> now, you can run the app directly on your watch turn on developer mode for health platform swipe down from the top of the screen to open the quick panel, then tap the settings icon scroll down and tap apps select health platform quckly tap health platform for about 10 times developer mode is enabled when [dev mode] appears below health platform noteyou can disable developer mode by quickly tapping the health platform until [dev mode] disappears start your project in android studio, click open to open existing project locate the downloaded android project from the directory and click ok check capabilities for the device to track data with the samsung health sensor sdk, it must support a given tracker type – blood oxygen level to check this, get the list of available tracker types and verify that the tracker is on the list in the connectionmanager java file, navigate to the isspo2available function, use a provided healthtrackingservice object to create a healthtrackercapability instance, send it to the checkavailabletrackers function, and assign its result to the availabletrackers list gettrackingcapability returns a healthtrackercapability instance in the healthtrackingservice object healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype public healthtrackercapability gettrackingcapability provide a healthtrackercapability instance to get a supporting health tracker type list /****************************************************************************************** * [practice 1] check capabilities to confirm spo2 availability * * ---------------------------------------------------------------------------------------- * * hint replace todo 1 with java code * get healthtrackercapability object from healthtrackingservice * send the object to checkavailabletrackers ******************************************************************************************/ public boolean isspo2available healthtrackingservice healthtrackingservice { if healthtrackingservice == null return false; list<healthtrackertype> availabletrackers = null; //"todo 1" if availabletrackers == null return false; else return availabletrackers contains healthtrackertype spo2_on_demand ; } check connection error resolution using samsung health sensor sdk api, resolve any error when connecting to health tracking service in the connectionmanager java file, navigate to the processtrackerexception function, and check if the provided healthtrackerexception object has a resolution assign the result to hasresolution variable hasresolution function in the healthtrackerexception object checks if the api can fix the error healthtrackerexceptionhealthtrackerexception contains error codes and checks the error's resolution if there is a resolution, solving the error is available by calling resolve activity boolean hasresolution checks whether the given error has a resolution /******************************************************************************************* * [practice 2] resolve healthtrackerexception error * * ----------------------------------------------------------------------------------------- * * hint replace todo 2 with java code * call hasresolution on healthtrackerexception object ******************************************************************************************/ public void processtrackerexception healthtrackerexception e { boolean hasresolution = false; //"todo 2" if hasresolution e resolve callingactivity ; if e geterrorcode == healthtrackerexception old_platform_version || e geterrorcode == healthtrackerexception package_not_installed observerupdater getobserverupdater notifyconnectionobservers r string novalidhealthplatform ; else observerupdater getobserverupdater notifyconnectionobservers r string connectionerror ; log e tag, "could not connect to health tracking service " + e getmessage ; } initialize spo2 tracker before the measurement starts, initialize the spo2 tracker by obtaining the proper health tracker object in the spo2listener java file, navigate to the init function using the provided healthtrackingservice object, create an instance of the spo2 tracker and assign it to the spo2tracker object gethealthtracker with healthtrackertype spo2_on_demand as an argument creates a healthtracker instance healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype healthtracker gethealthtracker healthtrackertype healthtrackertype provides a healthtracker instance for the given healthtrackertype /******************************************************************************************* * [practice 3] initialize spo2 tracker * * ---------------------------------------------------------------------------------------- * * hint replace todo 3 with java code * initialize spo2tracker with proper samsung health sensor sdk functionality * call gethealthtracker on healthtrackingservice object * use healthtrackertype spo2_on_demand as an argument ******************************************************************************************/ void init healthtrackingservice healthtrackingservice { //"todo 3" } perform measurement for the client app to start obtaining the data through the sdk, it has to set a listener method on the healthtracker the application setups the listener when the user taps on the measure button each time there is new data, the listener callback receives it after the measurement is completed, the listener has to be disconnected due to battery drain, on-demand measurement should not last more than 30 seconds the measurement is cancelled if the final value is not delivered in time note that the sensor needs a few seconds to warm up and provide correct values, which adds to the overall measurement time the blood oxygen level values come in the ondatareceived callback of trackereventlistener in spo2listener java file, you can see the code for reading the value private final healthtracker trackereventlistener spo2listener = new healthtracker trackereventlistener { @override public void ondatareceived @nonnull list<datapoint> list { for datapoint data list { updatespo2 data ; } } }; private void updatespo2 datapoint data { int status = data getvalue valuekey spo2set status ; int spo2value = 0; if status == measurement_completed spo2value = data getvalue valuekey spo2set spo2 ; observerupdater getobserverupdater notifytrackerobservers status, spo2value ; } run unit tests for your convenience, you can find an additional unit tests package this lets you verify your code changes even without using a physical watch see instructions below on how to run unit tests right-click on com samsung health spo2tracking test and execute run 'tests in 'com samsung health spo2tracking'' command if you completed all the tasks correctly, you can see that all the unit tests passed successfully run the app after building the apk, you can run the application on a connected device to measure blood oxygen level right after the app is started, it requests for user permission allow the app to receive data from the oxygen saturation sensor afterwards, it shows the application's main screen to get the blood oxygen level, tap on the measure button to stop the measurement, tap on the stop button you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create a health app that measures blood oxygen level by yourself! if you're having trouble, you may download this file measuring blood oxygen level complete code 152 6 kb to learn more about samsung health sensor sdk, visit developer samsung com/health/sensor
Learn Code Lab
codelabmeasure skin temperature on galaxy watch objective create a health app for galaxy watch, operating on wear os powered by samsung, utilizing samsung health sensor sdk to obtain skin temperature measurement results overview samsung health sensor sdk provides means of accessing and tracking health information contained in the health data storage its tracking service gives raw and processed sensor data such as accelerometer and body composition data sent by the samsung bioactive sensor the active sensor of galaxy watch runs powerful health sensors such as photoplethysmogram ppg , electrocardiogram ecg , bioelectrical impedance analysis bia , sweat loss, and spo2 see samsung health sensor sdk descriptions for detailed information set up your environment you will need the following galaxy watch5 or newer with updated health platform android studio latest version recommended java se development kit jdk 17 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! skin temperature tracking sample code 156 kb connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that the wi-fi is enabled from the list of available wi-fi networks, choose and connect to the same one as your pc turn on developer mode and adjust its settings on your watch, go to settings > about watch > software and tap on software version 5 times upon successful activation of developer mode, a toast message displays as on the image below afterwards, developer options is going to be visible under settings tap developer options and enable the following options adb debugging in developer options, search for wireless debugging turn on wireless debugging check always allow on this network, and tap allow go back to developer options, and click turn off automatic wi-fi notethere may be differences in settings depending on your one ui version connect your galaxy watch to android studio go to settings > developer options > wireless debugging and choose pair new device take note of the wi-fi pairing code, ip address & port in android studio, go to terminal and type adb pair <ip address> <port> <wi-fi pairing code> when prompted, tap always allow from this computer to allow debugging after successfully pairing, type adb connect <ip address of your watch> <port> upon successful connection, you can see the following message in android studio’s terminal connected to <ip address of your watch> now, you can run the app directly on your watch turn on developer mode for health platform swipe down from the top of the screen to open the quick panel, then tap the settings icon scroll down and tap apps select health platform quckly tap health platform for about 10 times developer mode is enabled when [dev mode] appears below health platform noteyou can disable developer mode by quickly tapping the health platform until [dev mode] disappears start your project in android studio, click open to open an existing project locate the downloaded android project skintemptracking from the directory and click ok check tracking capabilities to track the data with the sdk, the device must support skin temperature, like the galaxy watch5 skin temperature tracking can work in 2 modes batching and on-demand the tracker type for batching is healthtrackertype skin_temperature_continuous and healthtrackertype skin_temperature_on_demand for on-demand in this code lab, you are going to use on-demand tracker in connectionmanager java, navigate to isskintemperatureavailable function use a provided healthtrackingservice object to create a healthtrackercapability instance, and send it to checkavailabletrackers function, and assign its result to availabletrackers list gettrackingcapability returns a healthtrackercapability instance in healthtrackingservice object healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype public healthtrackercapability gettrackingcapability provide a healthtrackercapability instance to get a supporting healthtrackertype list /****************************************************************************************** * [practice 1] check capabilities to confirm skin temperature availability * * ---------------------------------------------------------------------------------------- * * hint replace todo 1 with java code * get healthtrackercapability object from healthtrackingservice * send the object to checkavailabletrackers ******************************************************************************************/ boolean isskintemperatureavailable healthtrackingservice healthtrackingservice { if healthtrackingservice == null return false; @suppresswarnings "unusedassignment" list<healthtrackertype> availabletrackers = null; //"todo 1" if availabletrackers == null return false; else return availabletrackers contains healthtrackertype skin_temperature_on_demand ; } initialization of skin temperature tracker before starting the measurement, initialize the skin temperature tracker by creating a healthtracker object in skintemperaturelistener java, navigate to setskintemperaturetracker using the provided healthtrackingservice object, create an instance of the healthtracker class of skin_temperature_on_demand type and assign it to the skintemperaturetracker object gethealthtracker with healthtrackertype skin_temperature_on_demand as an argument creates a healthtracker instance after a single measurement, the tracker should be stopped when using on-demand measurement for continuous measurement, use healthtrackertype skin_temperature_continuous healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype healthtracker gethealthtracker healthtrackertype healthtrackertype create a healthtracker instance for the given healthtrackertype /******************************************************************************************* * [practice 2] setup skin temperature tracker * * ---------------------------------------------------------------------------------------- * * hint replace todo 2 with java code * initialize skintemperaturetracker with proper samsung health sensor sdk functionality * call gethealthtracker on healthtrackingservice object * use healthtrackertype skin_temperature_on_demand as an argument ******************************************************************************************/ void setskintemperaturetracker healthtrackingservice healthtrackingservice { //"todo 2" } starting and stopping the tracker for the client app to obtain the data through the sdk, set a listener method on healthtracker this method is called every time there is new data healthtrackerhealthtracker enables an application to set an event listener and get tracking data for a specific healthtrackertype public void seteventlistener healthtracker trackereventlistener listener set an event listener to the healthtracker instance void starttracker { if !ishandlerrunning { skintemperaturehandler post -> skintemperaturetracker seteventlistener skintemperaturelistener ; ishandlerrunning = true; } } after the finished measurement, the on-demand tracker should be stopped you can do that by unsetting the event listener from healthtracker healthtrackerhealthtracker enables an application to set an event listener and get tracking data for a specific healthtrackertype public void unseteventlistener stop the registered event listener to this healthtracker instance void stoptracker { if skintemperaturetracker != null skintemperaturetracker unseteventlistener ; skintemperaturehandler removecallbacksandmessages null ; ishandlerrunning = false; } process obtained skin temperature data the answer from the healthtrackingservice is asynchronous the skintemperaturelistener receives the callback containing a data point with all the required information follow the steps below to get skin temperature data in skintemperaturelistener java, go to the updateskintemperature function and read skin temperature data from datapoint get skin temperature status using datapoint api key valuekey skintemperatureset status get skin temperature value using datapoint api key valuekey skintemperatureset object_temperature get ambient temperature value using datapoint api key valuekey skintemperatureset ambient_temperature datapointdatapoint provides a map of valuekey and value with a timestamp public <t>t getvalue valuekey<t>type get data value for the given key private final healthtracker trackereventlistener skintemperaturelistener = new healthtracker trackereventlistener { @override public void ondatareceived @nonnull list<datapoint> list { stoptracker ; for datapoint data list { updateskintemperature data ; } } }; /******************************************************************************************* * [practice 3] read values from datapoint object * - get skin temperature status value * - get wrist skin temperature value - it's named "object_temperature" in the library * - get ambient temperature value ------------------------------------------------------------------------------------------- * - hint replace todo 3 with parts of code * 1 remove skintemperaturestatus invalid_measurement and * set status from 'datapoint' object using data getvalue valuekey skintemperatureset status * * if status is 'skintemperaturestatus successful_measurement' then * 2 set wristskintemperaturevalue from 'datapoint' object using * data getvalue valuekey skintemperatureset object_temperature ; * 3 set ambienttemperaturevalue from 'datapoint' object using * data getvalue valuekey skintemperatureset ambient_temperature ; ******************************************************************************************/ void updateskintemperature datapoint data { final int status = skintemperaturestatus invalid_measurement; float wristskintemperaturevalue = 0; float ambienttemperaturevalue = 0; //"todo 3" trackerdatasubject notifyskintemperaturetrackerobservers status, ambienttemperaturevalue, wristskintemperaturevalue ; } run unit tests for your convenience, you can find an additional unit tests package this lets you verify your code changes even without using a physical watch see the instruction below on how to run unit tests right-click on com samsung health skintemptracking test and execute run 'tests in 'com samsung health skintemptracking" command if you have completed all the tasks correctly, you can see all the unit tests pass successfully run the app after building the apk, you can run the application on a connected device to measure your skin temperature once the app starts, allow the app to receive skin temperature data afterwards, the screen shows the application tap the measure button to get your wrist skin and ambient temperature you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create a health app that measures skin temperature by yourself! if you are having trouble, you may download this file skin temperature tracking complete code 155 5 kb to learn more about samsung health sensor sdk, visit developer samsung com/health/sensor
Learn Code Lab
codelabmeasure electrodermal activity on galaxy watch objective create a health app for galaxy watch, operating on wear os powered by samsung, utilizing samsung health sensor sdk to obtain electrodermal activity eda measurement results overview samsung health sensor sdk provides tools for accessing and tracking health information stored in the health data repository its tracking service delivers both raw and processed sensor data, including accelerometer readings and body composition metrics, collected by the samsung bioactive sensor electrocardiogram ecg , bioelectrical impedance analysis bia , photoplethysmogram ppg , heart rate, skin temperature, blood oxygen spo2 , and sweat loss data can be measured furthermore, the galaxy watch8 introduces electrodermal activity tracking electrodermal activity eda is a non-invasive physiological index that measures changes in skin conductance driven by sweat gland activity, reflecting the autonomic nervous system's response to both thermoregulation and psychological arousal see samsung health sensor sdk documentation for detailed information set up your environment you will need the following galaxy watch8 or newer android studio latest version recommended java se development kit jdk 17 or later android api level 36 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! electrodermal activity sample code 159 8 kb connect your galaxy watch with android studio watch the video below to connect to your galaxy watch for detailed instructions, visit this guide connect galaxy watch with android studio turn on developer mode for health platform watch the video below to enable developer mode for health platform on your galaxy watch for detailed instructions, visit this guide health platform’s developer mode start your project in android studio, click open to open existing project locate the downloaded android project edatracking from the directory and click select folder request for health permission the app utilizing samsung health sensor sdk requires the appropriate permissions and the user’s consent to access the vital signs information different permissions are required depending on the healthtrackertype you want to measure while this code lab focuses solely on healthtrackertype eda_continuous tracker type, the read_additional_health_data permission is also being used noteif the app’s target sdk version is android 15 api level 35 or lower, body_sensors permission is used go to app > manifests > androidmanifest xml and ensure the required permissions are added <uses-permission android name="android permission body_sensors" /> <uses-permission android name="com samsung android hardware sensormanager permission read_additional_health_data" /> next, the app needs to check if the user has already granted the permissions private fun ispermissiongranted = activitycompat checkselfpermission applicationcontext, permission!! == packagemanager permission_granted if no permission is granted, request the necessary permissions go to app > kotlin+java > com samsung health sensorsdksample edatracking > presentation > mainactivity kt and navigate to the preparepermission function complete the function to provide appropriate permissions based on the android version /**************************************************************************** * [practice 1] request health permissions * -------------------------------------------------------------------------- * * use the provided variable 'permission' * replace 'null' with proper value based on android version * if android sdk version is higher or equal android sdk 36 baklava use "com samsung android hardware sensormanager permission read_additional_health_data" permission * otherwise use "android permission body_sensors" ****************************************************************************/ fun preparepermission string? { val permission = if build version sdk_int >= build version_codes baklava { // todo replace 'null' with proper string value here null } else { // todo replace 'null' with proper string value here null } return permission } the returned permission is used in the requestpermissions function, which displays a pop-up asking for the user’s consent initialize eda tracker before starting the measurement, initialize the eda tracker by creating a healthtracker object navigate to app > kotlin+java > com samsung health sensorsdksample edatracking > tracking > edatrackingmanager kt and locate the obtainedatracker function using the provided healthtrackingservice object, create an instance of the healthtracker class with the eda_continuous type and assign it to the edatracker variable retrieve the healthtracker object using gethealthtracker use healthtrackertype eda_continuous as the parameter healthtrackerservice healthtrackerservice initiates a connection to samsung's health tracking service and provides an healthtracker instance to track a healthtrackertype healthtracker gethealthtracker healthtrackertype healthtrackertype provide a healthtracker instance for the given healthtrackertype /**************************************************************************** * [practice 2] setup eda tracker * -------------------------------------------------------------------------- * * use the provided variable 'edatracker' which is currently null * initialize eda tracker with proper sensor sdk functionality * call gethealthtracker function on 'healthtrackingservice' object * as an argument use healthtrackertype eda_continuous * assign the obtained tracker to 'edatracker' variable ****************************************************************************/ fun obtainedatracker healthtracker? { var edatracker healthtracker? = null // todo assign the tracker to the 'edatracker' variable here return edatracker } start and stop the tracker for the client app to begin retrieving data through the sdk, set a listener method on the healthtracker if successful, the event listener collects the sensor data until the measurement is stopped in the app noteonly one healthtracker trackereventlistener should be set per healthtrackertype healthtracker healthtracker enables an application to set an event listener and receive the galaxy watch's sensor data for a specific healthtrackertype void seteventlistener healthtracker trackereventlistener listener set an event listener for this healthtracker instance fun starttracking { edatracker = obtainedatracker if edatracker != null { edatracker!! seteventlistener trackerlistener _progressstate value = progressstate measuring true } else { scope launch { _messagestate emit messagestate trackernotinitialized } } } to stop the measurement, unset the trackereventlistener from the healthtracker object healthtracker healthtracker enables an application to set an event listener and receive the galaxy watch's sensor data for a specific healthtrackertype void unseteventlistener stop the registered event listener for this healthtracker instance fun stoptracking { if edatracker != null { edatracker!! unseteventlistener _progressstate value = progressstate measuring false } } obtain eda data the eda values are provided in the ondatareceived callback of trackereventlistener at a frequency of 1hz the platform's response is asynchronous and includes a data point object containing all the required information in the edatrackingmanager kt file, navigate to extractedavalues function to obtain eda data, read the skin conductance value and measurement status this can be extracted by specifying the appropriate keys in the getvalue function from the datapoint additionally, obtain the timestamp of the incoming data by calling the gettimestamp function from the datapoint retrieve the skin conductance value using the getvalue function with the key valuekey edaset skin_conductance retrieve the measurement status using the getvalue function with the key valuekey edaset status obtain the timestamp of the incoming data using the gettimestamp function datapoint datapoint is a map of valuekey and value with a timestamp long gettimestamp get a timestamp of the datapoint <t> t getvalue valuekey<t> type get a data value for the given key /**************************************************************************** * [practice 3] read values from datapoint object * - get skin conductance value * - get status value * - get timestamp * -------------------------------------------------------------------------- * * use the provided variable 'skinconductance' which is currently null * obtain skin conductance value using datapoint getvalue valuekey edaset skin_conductance * assign the obtained value into 'skinconductance' variable * * use the provided variable 'edastatus' which is currently null * obtain status using datapoint getvalue valuekey edaset status * assign the obtained value into 'edastatus' variable * * use the provided variable 'edatimestamp' which is currently null * obtain the 'timestamp' property from 'datapoint' object * assign the obtained value into 'edatimestamp' variable ****************************************************************************/ fun extractedavalues datapoint datapoint edavalue { var skinconductance float? = null var edastatus int? = null var edatimestamp long? = null // todo assign the skin_conductance value to the 'skinconductance' variable here // todo assign the status value to the 'edastatus' variable here // todo assign the timestamp property to the 'edatimestamp' variable here return edavalue skinconductance, edastatus fromint edastatus , edatimestamp } run unit tests for your convenience, you can find an additional unit tests package this lets you verify your code changes even without using a physical watch see the instructions below on how to run the unit tests right-click on com samsung health sensorsdksample edatracking test and select run ‘tests in ‘com samsung health sensorsdksample edatracking’’ if you completed all the tasks correctly, you can see that all the unit tests passed successfully run the app after building the apk, you can run the application on a connected device to measure your electrodermal activity values once the application starts, grant the app permission to access your vital signs information tap the start button to begin the electrodermal activity measurement the app shows your skin conductance, measurement status, and the time of the recorded data tap the stop button to stop the measurement you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create a health app that measures electrodermal activity eda on your own! if you are having trouble, you may download this file electrodermal activity complete code 159 3 kb to learn more about samsung health sensor sdk, visit developer samsung com/health/sensor
Develop Health
docrelease note release date august 20, 2025 release version v1 4 1 target device the samsung health sensor sdk is supported on the following watch devices that run on wear os powered by samsung galaxy watch4 series and later models sdk content content description documents api reference programming guide library the tracking library of the samsung health sensor sdk import it into your app project samsung-health-sensor-api aar sample apps measure blood oxygen measure blood oxygen and heart rate heart rate tracker transfer measured heart rate to a connected phone measure skin temperature ecg monitor sweat loss monitor features the tracking apis of the samsung health sensor sdk enable partner apps to register events for tracking health sensor data and to retrieve that data while tracking on a galaxy watch capabilities the samsung health sensor sdk provides the available tracker types on the watch measuring galaxy watch’s health sensor data a partner app using the sdk can measure health-sensor data of a galaxy watch the following tracker types are supported [continuous tracker types] the following tracker types can be measured continuously until the tracker type’s event listener is unset continuous tracker types operate with low battery consumption on the galaxy watch accelerometer electrodermal activity eda heart rate including ibi inter-beat interval photoplethysmogram ppg green, infrared ir , and red skin temperature [on-demand tracker types] the following tracker types are on-demand tracker types use only one on-demand tracker type at a time and only when needed bioelectrical impedance analysis bia multi-frequency bioelectrical impedance mf-bia electrocardiogram ecg ppg green, infrared ir , and red skin temperature spo2 blood oxygen [other] measuring the user’s sweat loss amount after a running is available with the following tracker type sweat loss developer mode a developer mode is supported for testing and debugging see the developer mode for more information restrictions the emulator is not supported data measured by the samsung health sensor sdk is for fitness and wellness information only, not for the diagnosis or treatment of any medical condition changes 1 4 1 - august 20, 2025 this patch version improves operational stability 1 4 0 - july 31, 2025 [new] the following enum values have been added to the healthtrackertype for measuring electrodermal activity eda and multi-frequency bioelectrical impedance mf-bia eda_continuous mf_bia_on_demand the following data sets have been added to the valuekey to receive the measured eda and mf-bia data edaset mfbiaset [change] required permissions to use each healthtrackertype have been changed for targeting android 16 api level or higher healthtrackertype for android 16 or higher bia_on_demand com samsung android hardware sensormanager permission read_additional_health_data ecg_on_demand eda_continuous mf_bia_on_demand ppg_continuous ppg_on_demand heart_rate_continuous healthpermissions read_heart_rate spo2_on_demand healthpermissions read_oxygen_saturation skin_temperature_continuous healthpermissions read_skin_temperature skin_temperature_on_demand sweat_loss manifest permission activity_recognition and com samsung android hardware sensormanager permission read_additional_health_data 1 3 0 - september 22, 2024 rebranding the sdk name to "samsung health sensor sdk" 1 3 0 - august 22, 2024 [new] continuous and on-demand enum constant names of healthtrackertype have been defined accelerometer_continuous bia_on_demand ecg_on_demand heart_rate_continuous ppg_continuous ppg_on_demand skin_temperature_on_demand spo2_on_demand an application can track one or more ppgtypes with ppg_continuous or ppg_on_demand the following api has been added healthtrackingservice gethealthtracker healthtrackertype, set<ppgtype> the following ppg types have been added ppgtype green ppgtype ir ppgtype red valuekey ppgset has been added it includes ppg green, ir, red data the following fields for bia’s raw data have been added in valuekey biaset body_impedance_degree body_impedance_magnitude [deprecated] the following enum constant names of healthtrackertype have been deprecated accelerometer use accelerometer_continuous bia use bia_on_demand ecg use ecg_on_demand heart_rate use heart_rate_continuous ppg_green use ppg_continuous ppg_ir use ppg_on_demand ppg_red use ppg_on_demand skin_temperature use skin_temperature_on_demand spo2 use spo2_on_demand the following ppg data set of valuekey have been deprecated use valuekey ppgset instead of them valuekey ppggreenset valuekey ppgirset valuekey ppgredset [removed] the following fields of valuekey ecgset have been removed use alternative fields valuekey ecgset ecg use valuekey ecgset ecg_mv valuekey ecgset max_threshold use valuekey ecgset max_threshold_mv valuekey ecgset min_threshold use valuekey ecgset min_threshold_mv the following fields of valuekey heartrateset have been removed use alternative fields valuekey heartrateset heart_rate_ibi use valuekey heartrateset ibi_list valuekey heartrateset status use valuekey heartrateset heart_rate_status and valuekey heartrateset ibi_status_list 1 2 0 - august 30, 2023 [new] the skin temperature tracker type and data point set have been added skin temperature can be measured on-demand or as a batching event for more information, see the api reference healthtrackertype skin_temperature healthtrackertype skin_temperature_continuous valuekey skintemperatureset the following interfaces for values in millivolts have been added to the ecg data point set ecg_mv max_threshold_mv min_threshold_mv the following interfaces for heart rate status and ibi-related information have been added to the heart rate data point set valuekey heartrateset heart_rate_status valuekey heartrateset ibi_list valuekey heartrateset ibi_status_list the status interface has been added to the following data point sets valuekey accelerometerset status valuekey ppggreenset status valuekey ppgirset status valuekey ppgredset status [change] the error description of the first bit in the 1 ~ 127 value for valuekey sweatlossset status has been updated [deprecated] the following interfaces in the ecg data point set have been deprecated valuekey ecgset ecg, replaced by valuekey ecgset ecg_mv valuekey ecgset max_threshold, replaced by valuekey ecgset max_threshold_mv valuekey ecgset min_threshold, replaced by valuekey ecgset min_threshold_mv the following interfaces in the heart rate data point set have been deprecated valuekey heartrateset heart_rate_ibi, replaced by valuekey heartrateset ibi_list valuekey heartrateset status, replaced by valuekey heartrateset heart_rate_status and valuekey heartrateset ibi_status_list [removed] valuekey heartrateset flag has been removed 1 1 0 - march 31, 2022 minor stability improvements have been made to the sdk library 1 1 0 alpha - march 17, 2022 [new] the spo2 tracker type and data point set have been added, which are supported by health platform v1 3 0 healthtrackertype spo2 valuekey spo2set valuekey heartrateset status has been added, which replaces valuekey heartrateset flag [changes] the trackingsampleapp application code has been updated [deprecated] valuekey heartrateset flag has been deprecated 1 0 0 - feb 25, 2022 the values for sweatlossset status have changed for more information, see the api reference 1 0 0 beta1 - dec 31, 2021 minor issues related to the sweat loss feature have been fixed 1 0 0 alpha3 - dec 17, 2021 [new] the sweat loss feature has been added, which measures how much sweat is lost during a run the following interfacess have been added datatype enum exercisestate enum exercisetype enum healthtrackertype sweat_loss enum vale healthtrackingservice gethealthtracker healthtrackertype healthtrackertype, trackeruserprofile userprofile, exercisetype type api valuekey sweatlossset class [known issue] the following issues are to be resolved in february 2022 watch software update a timestamp period variation issue in received sensor data for accelerometer, heart rate and ppg grenn an issue where healthtracker trackereventlistener onflushcompleted is not received 1 0 0 alpha2 - july 28, 2021 [change] the sdk policy has been applied tracking watch sensor data with the sdk is available only for the tracking types within the registered scope if sdk_policy_error occurs, talk to your samsung contact point the following interfaces have been added to the tracking data point sets the bia status has been defined valuekey biaset status check this value after a bia measurement if the status indicates an error, guide the user with a message and appropriate ui the ecg’s lead on/off values have been defined valuekey ecgset lead_off the flag for heart rate measurement has been added valuekey heartrateset flag in healthtracker trackererror the following unused errors have been removed low_signal movement_detected not_wearing time_out the following error has been added sdk_policy_error measurement guides for each sensor data have been added to the programing guide
Develop Galaxy Watch for Tizen
doccreate your first tizen wearable native watch application welcome to tizen wearable native watch application development! note for watch face developers you can create watch faces with galaxy watch studio or tizen studio for your personal enjoyment however you will not be able to add watch face applications to seller portal until you have received approval to publish watch faces the review is not required for watch app and widget developers galaxy store supports watch faces for galaxy watch3 and earlier samsung watches running on tizen watch faces for galaxy watch4 and later running on wear os powered by samsung is only supported in the chinese galaxy store a wearable native watch application is created using the c language, and can be run on tizen wearable devices to display a customized watch face to the user study the following instructions to help familiarize yourself with the tizen native application development process as well as using the tizen studio and installing the created application on the emulator or target device with the instructions, you can create and run a basic wearable native watch application, which displays some text and the current time on the screen before you get started with developing tizen applications, download and install the tizen studio for more information on the installation process, see the installation guide create a wearable native watch project using the tizen studio this step shows how you can use a predesigned project template that creates all the basic files and folders required for your project build the application after you have implemented code for the features you want, this step shows how you can build the application to validate and compile the code run the application this step shows how you can run the application on the emulator or a real target device design a ui this step shows how you can create the application ui and make small alterations to it to improve the usability of your application when you are developing a more complex application, you can take advantage of the native tools included in the tizen studio to ease the tasks of creating functionality and designing the application ui creating a project the following example shows you how to create and configure a basic wearable native watch application project in the tizen studio an application project contains all the files that make up an application the following figure illustrates the application to be created the application screen displays the hello watch text and the current time, which continues to be refreshed every second while the application runs figure wearable native watch application to create the application project launch the tizen studio in the tizen studio menu, select file > new > tizen project the project wizard opens in the project wizard, define the project details the project wizard is used to create the basic application skeleton with the required folder structure and mandatory files you can easily create different applications by selecting an applicable template or sample for the project wizard to use select the template project type and click next select the profile wearable and version from a drop-down list and click next the version depends on the platform version you have installed and with which you are developing the application select the native application application type and click next select the watch template and click next define the project properties and click finish you can enter the project name 3-50 characters and the unique package id you can also select the location and working sets by clicking more properties the project wizard sets up the project, creates the application files using the default content from the template, and closes for more information on the project wizard and the available templates, see creating tizen projects with tizen project wizard you can see the created project in the project explorer view the most important files and folders include inc default folder for included source files res folder for resource files used by the application only shared folder for resource files to be shared with other applications src folder for source code files lib folder for external library files tizen-manifest xml manifest file used by the platform to install and launch the application figure application in the project explorer note you can view and modify the application configuration in the manifest editor in this example, no configuration changes are required your application project is now ready for further actions next, build the application managing the application configuration to view and modify the application configuration in the project explorer view, double-click the tizen-manifest xml file of the application the tizen studio opens the file in the manifest editor in the manifest editor, view and modify the configuration details using the various tabs overview define general information, such as the package, label, and icon of the application features define required software and hardware features this information is used for application filtering in the tizen store privileges define the security-sensitive apis or api groups accessed and used by the application localization define localized values for the application label, description, and icon advanced define advanced features, such as application metadata and some miscellaneous options source view and edit the source code of the tizen-manifest xml file changes made and saved on the other tabs are reflected in the source code and vice versa note the tizen-manifest xml file must conform to both the xml file format and the tizen native application specification requirements editing the file in the source tab is intended for advanced users only to save any changes, in the tizen studio menu, select file > save all for more information on configuring the application, see setting the application manifest understanding the source code pay attention to the following main issues in the application source code in the inc/watch h and src/watch c files , to understand how the application is designed and how it works for source code details related to the ui, see designing a simple ui the watch application is initialized to use the functions and data types of the watch application api by including the <watch_app h> header file in your application #include <watch_app h> all header files that you need are already included in the watch h file, which is generated by the tizen studio when the template project is created the life-cycle callbacks manage specific parts of the application life-cycle they are set in the watch_app_lifecycle_callback_s structure, and the structure is passed to the watch_app_main function of the watch application api to start the watch application event loop int main int argc, char *argv[] { appdata_s ad = {0,}; int ret = 0; watch_app_lifecycle_callback_s event_callback = {0,}; app_event_handler_h handlers[5] = {null,}; event_callback create = app_create; event_callback terminate = app_terminate; event_callback pause = app_pause; event_callback resume = app_resume; event_callback app_control = app_control; event_callback time_tick = app_time_tick; event_callback ambient_tick = app_ambient_tick; event_callback ambient_changed = app_ambient_changed; ret = watch_app_main argc, argv, &event_callback, &ad ; if ret != app_error_none dlog_print dlog_error, log_tag, "watch_app_main is failed err = %d", ret ; return ret; } the create event is triggered before the application main loop starts in this callback, you can initialize the application resources, such as create windows and data structures static bool app_create int width, int height, void *data { /* hook to take necessary actions before the main event loop starts initialize ui resources and application's data if this function returns true, the main loop of application starts if this function returns false, the application is terminated */ appdata_s *ad = data; create_base_gui ad, width, height ; return true; } the time_tick event is triggered at least once per second the watch applications can get the current time from the watch_time time handle to draw a normal watch static void app_time_tick watch_time_h watch_time, void *data { /* called each second while your app is visible; update the watch ui */ appdata_s *ad = data; update_watch ad, watch_time, 0 ; } note for more information on the application life-cycle callbacks, see applications an ambient mode is available on a low-powered wearable device in this mode, the watch application shows a limited ui and receives only the ambient tick event every minute to reduce power consumption the details of the limited ui drawn in the ambient mode depend on the device in addition, due to the ambient mode being a low power mode, there are limits to the colors that can be shown on the screen usually, when designing the ambient mode ui, draw it with limited colors cyan, magenta, yellow, red, green, blue, black and white , and use less than 15% of the pixels on the screen if you do not want to draw your own ambient mode ui, set the ambient-support attribute to false in the watch application manifest file to allow the platform to show a default ambient mode ui note to use the ambient mode, the user must enable it in the device settings in addition, on the galaxy watch device, the ambient mode activates only when you are wearing the watch on the wrist - the `ambient_tick` callback is triggered every minute while the device is in the ambient mode you can use the callback to update the time on your watch application in the ambient mode in this callback, do not perform time-consuming tasks and always update the ui as quickly as possible the platform can put the device to sleep shortly after the ambient tick expires ```c static void app_ambient_tick watch_time_h watch_time, void *data { /* called at each minute while the device is in ambient mode update watch ui */ appdata_s *ad = data; update_watch ad, watch_time, 1 ; } ``` - the `ambient_changed` callback is triggered when the ambient mode is enabled or disabled on the device you can use the callback to initialize your ambient mode ui ```c static void app_ambient_changed bool ambient_mode, void *data { if ambient_mode /* prepare to enter the ambient mode */ else /* prepare to exit the ambient mode */ } ``` building your application after you have created the application project, you can implement the required features in this example, only the default features from the project template are used, and no code changes are required when your application code is ready, you must build the application the building process performs a validation check and compiles your files you can build the application in the following ways automatically the automatic build means that the tizen studio automatically rebuilds the application whenever you change a source or resource file and save the application project to use the automatic build select the project in the project explorer view in the tizen studio menu, select project > build automatically a check mark appears next to the menu option you can toggle the automatic build on and off by reselecting project > build automatically manually the manual build means that you determine yourself when the application is built to manually build the application, right-click the project in the project explorer view and select build project figure manually building the application alternatively, you can also select the project in the project explorer view and do one of the following in the tizen studio menu, select project > build project press the f10 key you can have more than one build configuration to see the current active configuration or change it, right-click the project in the project explorer view and select build configurations > set active the default configuration is debug for more information, see building applications after you have built the application, run it running your application you can run the application on the emulator or a real target device running on the emulator to run the application on the emulator launch an emulator instance in the emulator manager in the tizen studio menu, select tools > emulator manager in the emulator manager, select a wearable emulator from the list and click launch if no applicable emulator instance exists, create a new one the emulator is launched in its own window you can also see the new emulator instance and its folder structure in the device manager generate a security profile before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have created multiple emulator instances, select the instance you want from the combo box in the toolbar before selecting to run the application if you select an offline emulator, it is automatically launched when you select to run the application confirm that the application launches on the emulator note if the emulator display has switched off, you cannot see the application launch to switch the display on, click the power key in the lower-right corner of the emulator 3 change the watch face <a name="watchface"></a> to change the watch face and make the installed watch application visible ![changing the watch face] https //docs tizen org/application/native/get-started/wearable-watch/media/watch_run_change_wn png 1 if the emulator display has been switched off, activate it by pressing the **power** key in the lower-right corner of the emulator 2 on the home screen showing the default watch face , press the **power** key 3 in the recent apps screen, select **settings \> watch faces and styles \> watch faces** 4 swipe right until you find your application icon, and select it the **clock changed** message is displayed 5 press the **back** key in the upper-right corner of the emulator device multiple times, until the home screen with your new watch face is shown ![application running in the emulator] https //docs tizen org/application/native/get-started/wearable-watch/media/watch_run_face_wn png while the application is running, the **log** view in the tizen studio shows the log, debug, and exception messages from the methods defined in the log macros to see the view, in the tizen studio menu, go to **window \> show view \> log** for more information on using the emulator features, see using emulator control keys, menu, and panel and using extended emulator features running on a target device to run the application on a target device connect the wearable target device to your computer define settings on the device go to settings > connections, and switch on wi-fi the device and the computer must be connected to the same wi-fi network note the ip address the device is using go to settings > gear info, and switch on the debugging mode in the terminal, enter the following commands cd tizen-studio/tools /sdb connect <ip address of galaxy watch> use the ip address you noted before instead of the terminal, you can also use the remote device manager for the connection in the first attempt, the connection fails and the device asks for user confirmation to allow galaxy watch to read log data, copy files to and from your computer, and install the application manually, click the accept mark in the device manager, confirm that the device is connected shown in the device list generate an author certificate before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the device manager, select the device in project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have both a connected device and existing emulator instances, select the device from the combo box in the toolbar before selecting to run the application confirm that the application launches on the target device like with the emulator, you can change the watch face in the device settings to see the watch application on the home screen note the application is launched using the default debug run configuration to create and use another configuration in the project explorer view, right-click the project and select run as > run configurations in the run configurations window, click the new launch configuration icon , define the configuration details, and launch the application by clicking run designing a simple ui the wearable watch application created with the watch template has a simple user interface with a label component showing the hello watch text and the current time hour, minute, and second the ui is created using efl in the ambient mode, the watch template ui is identical to the normal ui, except that is shows the current time without the seconds figure user interface in the watch template ambient mode on the right creating the basic ui the ui in the watch template contains the following components the efl ui always contains a window component, which is the root component of the entire ui the application uses the conformant component as a container for other ui components the label showing the hello watch text and the current time is implemented with a label component the ui is created in the watch c file data structure a pointer to the ui components is stored in the appdata_s data structure struct appdata { /* window */ evas_object *win; /* conformant */ evas_object *conform; /* label */ evas_object *label; }; typedef struct appdata appdata_s; ui creation the app_create life-cycle callback is called when the application main loop starts, and it calls the create_base_gui function to create the ui static bool app_create int width, int height, void *data { /* define system callbacks */ appdata_s *ad = data; create_base_gui ad, width, height ; return true; } ui components the create_base_gui function creates the ui components window, conformant, and label the function receives a pointer to fill in the appdata_s structure static void create_base_gui appdata_s *ad, int width, int height { the window object of the idle screen is retrieved with the watch_app_get_elm_win function of the watch application api the watch_time_h handle is created for managing the current time, and the evas_object_resize function is used to resize the window to fit the screen int ret; watch_time_h watch_time = null; ret = watch_app_get_elm_win &ad->win ; if ret != app_error_none { dlog_print dlog_error, log_tag, "failed to get window err = %d", ret ; return; } evas_object_resize ad->win, width, height ; the conformant component is used as a container for the other ui components the component is the first object added inside the window with the elm_conformant_add function the conformant component is set as a resize object of the window by using the elm_win_resize_object_add function it means that the conformant size and position are controlled by the window component directly the evas_object_show function makes the conformant component visible ad->conform = elm_conformant_add ad->win ; evas_object_size_hint_weight_set ad->conform, evas_hint_expand, evas_hint_expand ; elm_win_resize_object_add ad->win, ad->conform ; evas_object_show ad->conform ; the label component for the text and time is added with the elm_label_add function the label is added inside the conformant component, which is the label's parent the label is resized and moved so that it is located below the first third of the screen height ad->label = elm_label_add ad->conform ; evas_object_resize ad->label, width, height / 3 ; evas_object_move ad->label, 0, height / 3 ; evas_object_show ad->label ; the watch_time_get_current_time function retrieves the current time, and the update_watch function uses the current time to set the label component content finally, the watch_time_h handle is deleted ret = watch_time_get_current_time &watch_time ; if ret != app_error_none dlog_print dlog_error, log_tag, "failed to get current time err = %d", ret ; update_watch ad, watch_time, 0 ; watch_time_delete watch_time ; when all the ui components are ready, the evas_object_show function makes the window component visible this means that the window displays everything on the screen at once evas_object_show ad->win ; } modifying existing components when the basic ui exists, you can easily modify the components in the ui by using the component-specific functions, or more general evas object functions for example, the following modification to the label component changes the text color to red ad->label = elm_label_add ad->conform ; evas_object_color_set ad->label, 255, 0, 0, 255 ; evas_object_resize ad->label, width, height / 3 ; evas_object_move ad->label, 0, height / 3 ; evas_object_show ad->label ; figure modified label component showing the current time you can update the time on the screen with the time_tick in the normal mode or ambient_tick in the ambient mode callback both callbacks contain the current time handle, and call the update_watch function to update the label content on the screen static void app_time_tick watch_time_h watch_time, void *data { appdata_s *ad = data; update_watch ad, watch_time, 0 ; } static void app_ambient_tick watch_time_h watch_time, void *data { appdata_s *ad = data; update_watch ad, watch_time, 1 ; } in the update_watch function, the watch_time_h handle is used to retrieve the current time elements hour, minute, and second with the watch_time_get_hour24 , watch_time_get_minute , and watch_time_get_second functions of the watch application api the text for the label component is defined based on whether the normal or ambient mode is used , and set with the elm_object_text_set function static bool update_watch appdata_s *ad, watch_time_h watch_time, int ambient { char watch_text[text_buf_size]; int hour24; int minute; int second; if watch_time == null return; watch_time_get_hour24 watch_time, &hour24 ; watch_time_get_minute watch_time, &minute ; watch_time_get_second watch_time, &second ; if !ambient { snprintf watch_text, text_buf_size, "<align=center>hello watch<br/>%02d %02d %02d</align>", hour24, minute, second ; } else { snprintf watch_text, text_buf_size, "<align=center>hello watch<br/>%02d %02d</align>", hour24, minute ; } elm_object_text_set ad->label, watch_text ; }
Learn Code Lab
codelabmeasure blood oxygen level and heart rate on galaxy watch objective create a health app for galaxy watch, operating on wear os powered by samsung, utilizing samsung health sensor sdk to trigger and obtain results of simultaneous blood oxygen level spo2 and heart rate measurements overview samsung health sensor sdk provides means of accessing and tracking health information contained in the health data storage its tracking service gives raw and processed sensor data such as accelerometer and body composition data sent by the samsung bioactive sensor the latest bioactive sensor of galaxy watch runs powerful health sensors such as photoplethysmogram ppg , electrocardiogram ecg , bioelectrical impedance analysis bia , sweat loss, and spo2 see samsung health sensor sdk descriptions for detailed information set up your environment you will need the following galaxy watch4 or newer android studio latest version recommended java se development kit jdk 11 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! measuring blood oxygen level and heart rate sample code 164 2 kb connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that wi-fi is enabled from the list of available wi-fi networks, choose and connect to the same one as your pc turn on developer mode and adjust its settings on your watch, go to settings > about watch > software and tap on software version 5 times upon successful activation of developer mode, a toast message displays as on the image below afterwards, developer options is going to be visible under settings tap developer options and enable the following options adb debugging in developer options find wireless debugging turn on wireless debugging check always allow on this network and tap allow go back to developer options and click turn off automatic wi-fi notethere may be differences in settings depending on your one ui version connect your galaxy watch to android studio go to settings > developer options > wireless debugging and choose pair new device take note of the wi-fi pairing code, ip address & port in android studio, go to terminal and type adb pair <ip address> <port> <wi-fi pairing code> when prompted, tap always allow from this computer to allow debugging after successfully pairing, type adb connect <ip address of your watch> <port> upon successful connection, you can see the following message in android studio’s terminal connected to <ip address of your watch> now, you can run the app directly on your watch turn on developer mode for health platform swipe down from the top of the screen to open the quick panel, then tap the settings icon scroll down and tap apps select health platform quckly tap health platform for about 10 times developer mode is enabled when [dev mode] appears below health platform noteyou can disable developer mode by quickly tapping the health platform until [dev mode] disappears start your project in android studio, click open to open existing project locate the downloaded android project from the directory and click ok establish service connection and check capabilities for the device to track data with the samsung health sensor sdk, it must connect to the service by healthtrackingservice api after establishing a connection, verify if the required tracker type is available to check this, get the list of available tracker types and verify that the tracker is on the list in this code lab, you're going to utilize blood oxygen level and heart rate trackers the healthtrackingservice api usage is in the table below healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype public void connectservice establish a connection with samsung's health tracking service public void disconnectservice release a connection for samsung's health tracking service public healthtrackercapability gettrackingcapability provide a healthtrackercapability instance to get a supporting health tracker type list initialize multiple trackers before the measurement starts, initialize the spo2 tracker by obtaining the proper health tracker object in the connectionmanager java file, navigate to initspo2 , create an oxygen saturation healthtracker instance, and pass it to the spo2listener instance get the healthtracker object using the healthtrackingservice api use the healthtrackertype spo2_on_demand type as parameter healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype public healthtracker gethealthtracker healthtrackertype healthtrackertype provide a healthtracker instance for the given healthtrackertype pass the healthtracker object to the spo2listener instance object spo2listener public void sethealthtracker healthtracker tracker set healthtracker instance for the given tracker /******************************************************************************************* * [practice 1] create blood oxygen level health tracker object * - get health tracker object * - pass it to spo2listener ------------------------------------------------------------------------------------------- * - hint replace todo 1 with parts of code * 1 get healthtracker object using healthtrackingservice gethealthtracker * use healthtrackertype spo2_on_demand type as parameter * 2 pass it to spo2listener using sethealthtracker function ******************************************************************************************/ public void initspo2 spo2listener spo2listener { //"todo 1 1 " //"todo 1 2 " sethandlerforbaselistener spo2listener ; } next, in the connectionmanager java file, in the initheartrate function, create a heart rate healthtracker instance, and pass it to the heartratelistener instance get the healthtracker object using the healthtrackingservice api use the healthtrackertype heart_rate_continuous type as parameter pass the healthtracker object to the heartratelistener instance object heartratelistener public void sethealthtracker healthtracker tracker set healthtracker instance for the given tracker /******************************************************************************************* * [practice 2] create heart rate health tracker object * - get health tracker object * - pass it to heartratelistener ------------------------------------------------------------------------------------------- * - hint replace todo 2 with parts of code * 1 get healthtracker object using healthtrackingservice gethealthtracker * use healthtrackertype heart_rate_continuous type as parameter * 2 pass it to heartratelistener using sethealthtracker function ******************************************************************************************/ public void initheartrate heartratelistener heartratelistener { //"todo 2 1 " //"todo 2 2 " sethandlerforbaselistener heartratelistener ; } start and stop trackers for the client app to start obtaining the data through the sdk, set a listener method on healthtracker this method is called every time there is new data after the measurement completes, the listener has to be disconnected to start measurement in the baselistener java file, navigate to starttracker function, and set trackereventlistener as listener healthtracker object set an event listener on healthtracker object using healthtracking api use the healthtracker trackereventlistener object instance as parameter healthtrackerhealthtracker enables an application to set an event listener and get tracking data for a specific healthtrackertype public void seteventlistener healthtracker trackereventlistener listener set an event listener to this healthtracker instance /******************************************************************************************* * [practice 3] start health tracker by setting event listener * - set event listener on health tracker ------------------------------------------------------------------------------------------- * - hint replace todo 3 with parts of code * set event listener on healthtracker object using healthtracker seteventlistener * use trackereventlistener object as parameter ******************************************************************************************/ public void starttracker { log i app_tag, "starttracker called " ; log d app_tag, "healthtracker " + healthtracker tostring ; log d app_tag, "trackereventlistener " + trackereventlistener tostring ; if !ishandlerrunning { handler post -> { //"todo 3" sethandlerrunning true ; } ; } } to stop measurement, unset the trackereventlistener from the healthtracker object in the stoptracker function unset the event listener on healthtracker object using healthtracking api healthtrackerhealthtracker enables an application to set an event listener and get tracking data for a specific healthtrackertype public void unseteventlistener stop the registered event listener to this healthtracker instance /******************************************************************************************* * [practice 4] stop health tracker by removing event listener * - unset event listener on health tracker ------------------------------------------------------------------------------------------- * - hint replace todo 4 with parts of code * unset event listener on healthtracker object using healthtracker unseteventlistener ******************************************************************************************/ public void stoptracker { log i app_tag, "stoptracker called " ; log d app_tag, "healthtracker " + healthtracker tostring ; log d app_tag, "trackereventlistener " + trackereventlistener tostring ; if ishandlerrunning { //"todo 4" sethandlerrunning false ; handler removecallbacksandmessages null ; } } process obtained and batching data the response from the platform is asynchronous with the results you want to obtain follow the steps below to get blood oxygen level and heart rate data in the spo2listener java file, navigate to updatespo2 function, and read spo2 data from datapoint get the oxygen saturation status using the datapoint api key valuekey spo2set status get the oxygen saturation value using the datapoint api key valuekey spo2set spo2 datapointdatapoint provides a map of valuekeyand value with a timestamp public <t>t getvalue valuekey<t> type get data value for the given key /******************************************************************************************* * [practice 5] read values from datapoint object * - get blood oxygen level status * - get blood oxygen level value ------------------------------------------------------------------------------------------- * - hint replace todo 5 with parts of code * 1 remove spo2status calculating and * set status from 'datapoint' object using datapoint getvalue valuekey spo2set status * 2 set spo2value from 'datapoint' object using datapoint getvalue valuekey spo2set spo2 * if status is 'spo2status measurement_completed' ******************************************************************************************/ public void updatespo2 datapoint datapoint { int status = spo2status calculating; //"todo 5 1 " int spo2value = 0; //"todo 5 2 " trackerdatanotifier getinstance notifyspo2trackerobservers status, spo2value ; log d app_tag, datapoint tostring ; } in the heartratelistener java file, navigate to readvaluesfromdatapoint function, and read the heart rate data from datapoint get heart rate status using datapoint api key valuekey heartrateset heart_rate_status get heart rate value using datapoint api key valuekey heartrateset heart_rate get heart rate ibi value using datapoint api key valuekey heartrateset ibi_list get ibi quality using datapoint api key valuekey heartrateset ibi_status_list /******************************************************************************************* * [practice 6] read values from datapoint object * - get heart rate status * - get heart rate value * - get heart rate ibi value * - check retrieved heart rate’s ibi and ibi quality values ------------------------------------------------------------------------------------------- * - hint replace todo 6 with parts of code * 1 set hrdata status from 'datapoint' object using datapoint getvalue valuekey heartrateset heart_rate_status * 2 set hrdata hr from 'datapoint' object using datapoint getvalue valuekey heartrateset heart_rate * 3 set local variable 'list<integer> hribilist' using datapoint getvalue valuekey heartrateset ibi_list * 4 set local variable 'final list<integer> hribistatus' using datapoint getvalue valuekey heartrateset ibi_status_list * 5 set hrdata ibi with the last of 'hribilist' values * 6 set hrdata qibi with the last of 'hribistatus' values ******************************************************************************************/ public void readvaluesfromdatapoint datapoint datapoint { heartratedata hrdata = new heartratedata ; //"todo 6 1 " //"todo 6 2 " //"todo 6 3 " //"todo 6 4 " //"todo 6 5 " //"todo 6 6 " trackerdatanotifier getinstance notifyheartratetrackerobservers hrdata ; log d app_tag, datapoint tostring ; } run unit tests for your convenience, you can find an additional unit tests package this lets you verify your code changes even without using a physical watch see instructions below on how to run unit tests right-click on com samsung health multisensortracking test and execute run 'tests in 'com samsung health multisensortracking'' command if you completed all the tasks correctly, you can see that all the unit tests passed successfully run the app after building the apk, you can run the application on a connected device to see blood oxygen level and heart rate values right after the app is started, it requests for user permission allow the app to receive data from heart rate and oxygen saturation sensors afterwards, it shows the application's main screen and automatically display the heart rate to get the blood oxygen level spo2 value, tap on the measure button to stop the measurement, tap on the stop button tap on the details label to see more heart rate data you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create a health app that measures blood oxygen level and heart rate by yourself! if you're having trouble, you may download this file measuring blood oxygen level and heart rate complete code 163 5 kb to learn more about samsung health sensor sdk, visit developer samsung com/health/sensor
Learn Code Lab
codelabdesign a watch face with customizable edge complication slots and digital clock objective learn how to add customizable edge complication slots and a digital clock on your watch face using watch face studio overview watch face studio is a graphical authoring tool designed to help users create watch faces for the wear os smartwatch ecosystem, including the galaxy watch4 and its newer versions it offers intuitive and user-friendly features for designing visually appealing and customizable watch faces without requiring coding skills with watch face studio, users can incorporate various components into their watch faces, such as digital clocks these clocks can be designed with different variations and further customized through the galaxy watch interface in addition to digital clocks and other watch face components, users can integrate complications into their designs complications display information from data sources, such as battery indicators or step counts, directly on the watch face you can display additional information on the watch face by adding a complication slot a complication slot consists of complication components and a slot bound the components implement the layout, while the slot bound acts as a cutout through which the complication component appears there are five types of complication slots circle, line, small box, large box, and edge this code lab focuses on adding edge complication slots to your watch face starting from watch face studio 1 8 7 beta , users can define all supported font styles for digital clocks that can be customized on the physical watch the studio also added a feature allowing users to design watch faces with edge complication slots set up your environment you will need the following watch face studio latest version galaxy watch4 or newer smartwatch running on wear os api 34 or higher sample project here is a sample project for you to start coding in this code lab download it and start your learning experience! customizable edge complication and digital clock sample project 363 7 kb start your project to load the sample project in watch face studio click open project locate the downloaded file and click open the sample project includes a background image that you can customize by adjusting the hue, saturation, lightness, or opacity to suit your preference add edge complications to the watch face there are two types of edge complication slots that you can add to the watch face duo and quadrant both appear along the edge of the watch face duo edge complication slot - composed of right and left edge complications quadrant edge complication slot - composed of right top, right bottom, left bottom, and left top edge complications you can only select one type per project to fit the design of the sample project, add a quadrant edge complication slot click add component then, in the complication slot section, select edge > quadrant noteyou cannot change the placement, dimension, or rotation angle of an edge complication slot however, you can delete or hide unused complications from the layer list, expand the quadrant edge complication layer select the right top edge complication and the left bottom edge complication right-click and choose delete notealthough you have already deleted a complication slot, it can still be restored to do this, right-click on the quadrant edge complication layer in the layer list and select the option to add the previously deleted complication back configure complications after adding the edge complication slots, you can configure its settings from the layer list, click the right bottom edge complication to edit its properties in the properties pane, go to complication settings and choose the following type fixed default provider watch battery complication type range value range value complication layout progress bar + icon + text notesetting the complication as fixed limits the data and provider to the values you defined customization of this complication on the physical watch or wearable app is not possible to test the complication, go to the run pane and adjust the watch battery slider the bar indicator updates based on the value of the watch battery next, go to the properties of the left top edge complication and choose the following for complication settings type editable supported types short text default provider step count short text complication layout icon + text + title to test the complication, go to the run pane and adjust the step count slider the complication text changes as you change the value of the slider you can also adjust the properties of each complication component for example, when you open the properties of title, you can change its text color add a variable digital clock there are two ways to display a digital clock on watch faces using a variable digital clock and a non-variable digital clock to understand the concept of these two types, start by adding a variable digital clock component to display hours and a colon go to add component > digital clock > variable select colon and h h for the hour adjust the placement and rotation angle of both components to complement the design with a variable digital clock, you can customize each subcomponent creatively for example, you can make the font of the first digit of the hour h10 bigger than the second digit h or place them in different positions adjust the properties of the first and second digits of the hour to have the same font size but with slightly different color tints h10 color #f5f680ff font size 70 h color #fde997ff font size 70 on the other hand, a non-variable digital clock is less flexible but acts as a single component, making it ideal for simpler watch faces to add a non-variable digital clock to display minutes go to add component > digital clock > mm adjust its placement, rotation angle, and text color to complement the design use bitmap font for minutes watch face studio supports the use of truetype and bitmap fonts by default, all text-based components, such as digital clocks, use truetype fonts truetype is the most common font format, utilizing vector-based outlines to define characters bitmap fonts, on the other hand, consist of fixed-size, pixel-based representations of characters, which have smaller file sizes and render directly as pixels, offering faster performance on low-power devices in watch face studio, bitmap fonts are used to replace predefined dynamic content, such as dates, time, and weather, in text and digital clock components this allows you to incorporate custom visual elements that align with your creative vision while maintaining functionality to use bitmap font on your watch face, follow these steps select mm from the layer list go to properties > font setting and select bitmap font click the gear icon to open the bitmap font setting for bitmap font 1 set the default font size to 50 click the + icon to add and assign bitmap images for each digit locate your bitmap images, select the image for the corresponding digit, and click open once you're done adding and assigning bitmap images for each digit, click ok to display the bitmap font as minutes noteyou can also add more bitmap fonts by opening the dropdown menu and selecting add bitmap font make the font style of the digital clock customizable to make the digital clock more customizable, you can apply styles use the style tab to define font styles for a digital clock layer this provides users with more customization options for their watch face noteyou can apply styles to digital clock fonts and image-based layers for detailed information, refer to the style tab documentation from the layer list, choose variable_hh > h10 and go to the style tab click the + button in truetype font to add font styles add fonts with bold font weights such as montserrat-bold, oswald-bold, and roboto-bold then, click the customization editor button in the style set pane, click the text id button beside id_system_style_set click the add new button to add a new text id then, input the following id id_h10_font default value 1st digit hour font then, select the newly added text id this helps users identify which components they are changing when customizing the style on a physical watch repeat the same process for h, and this time, add fonts with a medium font weight for the text id, input the following id id_h_font default value 2nd digit hour font next, add styles to a layer that uses a bitmap font select mm from the layer list and go to the style tab click the + button in bitmap font, then select add bitmap font to add and assign bitmap images for each digit set default font size to 50 click ok and input the name of your bitmap font then, click the customization editor button and modify the text id of the newly added style set using the following values id id_mm_font default value minute font to test the font styles you set, go to the run pane and choose font styles from the dropdown menu this allows you to preview how the selected styles will appear on the watch face tipyou can merge the styles by navigating to the customization editor select the style sets you want to merge, right-click, and then choose merge set test the watch face in the run pane click the preview watch face icon move the step count and watch battery sliders to see data changes in the edge complications as previously mentioned, to observe changes in the digital clock, adjust the time slider and select the font styles from the dropdown menu in the style section to test your watch face on a smartwatch, you need to connect your watch to the same network as your computer in watch face studio, select run on device select the connected watch you want to test with if your watch is not detected automatically, click scan devices to detect your device or enter its ip address manually by clicking the + button when the watch face is launched, touch and hold the watch screen to access the edit mode tap customize to choose font styles and complications notethe always-on display is already set in the project to run the watch face successfully, you may need to configure its always-on display to avoid any error when you click run on device you're done! congratulations! you have successfully achieved the goal of this code lab now, you can design a watch face with customizable edge complication slots and digital clock using watch face studio! if you’re having trouble, you may download this file customizable edge complication and digital clock complete project 420 8 kb to learn more about watch face studio, visit developer samsung com/watch-face-studio
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
These cookies collect information about how you use our website. for example which pages you visit most often. All information these cookies collect is used to improve how the website works.
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and tailor the website to provide enhanced features and content for you.
You have successfully updated your cookie preferences.