Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
tutorials health, galaxy watch, mobile
blogsleep is an important factor in our everyday life. good sleeping habits play a major role in physical health and overall well-being. with galaxy watch and samsung health, users can track their sleep, evaluate its quality, and get coaching to develop healthy habits. when the user wakes up, the sleep data is analyzed and the user can review key sleep statistics and how much time they spent in each sleep stage. sleep coaching functionality compares data to previous days, so the user can track how their daily routine improvements influence their sleep quality. galaxy watch devices can also measure blood oxygen during sleep, and users with a galaxy watch5 or higher can also track their skin temperature. when a phone is used together with the watch for sleep tracking, snoring detection is also possible. sleep tracking you can leverage samsung health advanced sleep tracking and health connect api to create applications that can read users’ real sleep data and create custom sleep session information that can be synchronized to samsung health. this blog demonstrates how to use the health connect api to read data from health connect, work with session data, and insert data to health connect, using sleep data as an example. to follow along with the steps in this blog, download the sample application: sleep recorder version 1.0 (128,0kb) jan 15, 2024 for more information about samsung health and health connect, see accessing samsung health data through health connect.. sleep data synchronization with health connect the health connect platform collects health-related data and synchronizes it with samsung health, enabling you to use it in your applications. sleep data is created on a smartwatch when the user wakes up. the data must be transferred to a paired mobile device for processing. data transfer is initiated when the mobile device is connected. the processed data creates a sleep record, which samsung health synchronizes to health connect. transfer and synchronization tasks can be delayed, depending on processor availability. prerequisites implementing functionality that uses health data in an application requires health connect library, healthconnectionclient, and permissions. add health connect api library dependencies to use the health connect api features in your application: dependencies { // add health connect library implementation "androidx.health.connect:connect-client:1.1.0-alpha06" } configure the “androidmanifest.xml” file declare the required permissions: <uses-permission android:name="android.permission.health.write_sleep"/> <uses-permission android:name="android.permission.health.read_sleep" /> add <intent-filter> in the <activity> section: <intent-filter> <action android:name="androidx.health.action_show_permissions_rationale" /> </intent-filter> add the <activity-alias> element required in android 14: <activity-alias android:name="viewpermissionusageactivity" android:exported="true" android:targetactivity=".mainmenuactivity" android:permission="android.permission.start_view_permission_usage"> <intent-filter> <action android:name="android.intent.action.view_permission_usage" /> <category android:name="android.intent.category.health_permissions" /> </intent-filter> </activity-alias> add <uses-permission> elements: <uses-permission android:name="android.permission.health.write_sleep"/> <uses-permission android:name="android.permission.health.read_sleep" /> add the <queries> element: <queries> <package android:name="com.google.android.apps.healthdata" /> </queries> note that in this application we also use: <package android:name="com.sec.android.app.shealth" /> adding this element is necessary, since we are going to open the samsung health app. however, if you are interested in using only the health connect api – the above part is not required. get a healthconnect client the healthconnectclient class is an entry point to the health connect api. it automatically manages the connection to the underlying storage layer and handles all ipc and serialization of the outgoing requests and the incoming responses. it is a good practice to ensure that the device running your application actually supports the health connect api library. the library is available only when the health connect application is installed on the device. noteandroid 14 health connect is part of the system and is installed by default. however in earlier versions, it's necessary to check if health connect is present on the device. check for health connect availability. if it is missing, display an error and redirect the user to the app store if installation of the app is possible: when (healthconnectclient.getsdkstatus(this)) { healthconnectclient.sdk_unavailable -> { // error message } healthconnectclient.sdk_unavailable_provider_update_required -> { // error message try { startactivity( intent( intent.action_view, uri.parse("market://details?id=com.google.android.apps.healthdata"), ), ) } catch (e: activitynotfoundexception) { startactivity( intent( intent.action_view, uri.parse("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata"), ), ) } } if health connect is available, get a healthconnectclient class instance: private val healthconnectclient by lazy { healthconnectclient.getorcreate(context) } request user permissions your application must request permission from the user to use their health data. create a set of permissions for the required data types. the permissions must match those you defined in the androidmanifest.xml file. val permissions = setof( healthpermission.getwritepermission(sleepsessionrecord::class), healthpermission.getreadpermission(sleepsessionrecord::class), ) check whether the user has granted the required permissions: suspend fun hasallpermissions(): boolean { if (healthconnectclient.sdkstatus(context) != healthconnectclient.sdk_available) { return false } return healthconnectclient.permissioncontroller.getgrantedpermissions() .containsall(permissions) } if not, launch the permission request: if (!healthconnectmanager.hasallpermissions()) { requestpermissions.launch(healthconnectmanager.permissions) } create the permissions prompt: private fun createrequestpermissionsobject() { requestpermissions = registerforactivityresult(healthconnectmanager.requestpermissionactivitycontract) { granted -> lifecyclescope.launch { if (granted.isnotempty() && healthconnectmanager.hasallpermissions()) { runonuithread { toast.maketext( this@mainmenuactivity, r.string.permission_granted, toast.length_short, ) .show() } } else { runonuithread { alertdialog.builder(this@mainmenuactivity) .setmessage(r.string.permissions_not_granted) .setpositivebutton(r.string.ok, null) .show() } } } } } retrieve sleep data from health connect in the sample application, to display sleep data, select a date and tap read data. a list of sleep sessions for that day is displayed. when you select a session, the application retrieves and displays its sleep stage information from health connect. to retrieve and display sleep session data: define the desired time range and send it to health connect manager. since a sleep session can start on the day before the selected date, be sure the application also retrieves sleep sessions from the previous day and later ignores the sessions that do not match the desired time range. val starttime = chosenday.minusdays(1).atstartofday(zoneid.systemdefault()).toinstant() val endtime = starttime.plus(2, chronounit.days).minus(1, chronounit.millis) val sleepsessions = healthconnectmanager.readsleepsessionrecords( starttime, endtime, ) retrieve the list of sleep session records in health connect manager. create a readrecordsrequest object and send it to health connect: val request = readrecordsrequest( recordtype = sleepsessionrecord::class, timerangefilter = timerangefilter.between(start, end), ) val response = healthconnectclient.readrecords(request) return response.records display the records in a listview on the application screen: for (session in sleepsessions) { sleepsessionranges.add(timerange.between(session.starttime, session.endtime)) val sessionstart = session.starttime.atzone(zoneid.systemdefault()).format( datetimeformatter.iso_local_time, ) val sessionend = session.endtime.atzone(zoneid.systemdefault()).format( datetimeformatter.iso_local_time, ) sleepstageslists.add(session.stages) sleepsessionsadapter.add("start: $sessionstart\t\tend: $sessionend gmt ${session.startzoneoffset}") } when a session is selected, display its sleep stage details: for (stage in sleepstageslists[sleepsessionindex]) { val stagestart = stage.starttime.atzone(zoneid.systemdefault()).format( datetimeformatter.iso_local_time, ) val stageend = stage.endtime.atzone(zoneid.systemdefault()).format( datetimeformatter.iso_local_time, ) val stagename = healthconnectmanager.enumtostagemap.getvalue(stage.stage) sleepstagesadapter.add("$stagestart\t-\t$stageend\t\t$stagename") } notealthough data is inserted to and stored in health connect in utc time with time zone offset, data retrieved from health connect is displayed in local time. you can extract health connect sleep data from any source, including data from galaxy watch. the following figure shows a sleep session in samsung health and the same data presented in the sample application. sleep data in samsung health and sample application create and insert sleep session data health connect not only allows you to read sleep data that is collected through samsung health, it also enables you to manually insert sleep data that can be synchronized to samsung health. to manually insert sleep data to health connect, you must prepare both a sleep session and sleep stage data. a session is a time interval during which a user performs an activity, such as sleeping. to prepare a session, you need to know its start and end time. in the sample application, an optional time zone offset is also implemented, since data in health connect database is stored in utc. if the session start hour and minute is later than the end hour and minute, the session is interpreted as starting on the previous day. in the following figure, the session is interpreted to have started at 22:00 on 2023-12-10 and ended at 06:00 on 2023-12-11. sleep session duration in the following part of the application, sleep stages can be added within the sleep session. to add a sleep stage, define its start time, end time, and name. for compatibility with samsung health, use the sleep stage names awake, light, rem, and deep. each defined sleep stage is visible in the list. ideally, sleep stages cover the entire sleep session, but this is not a requirement for synchronizing with samsung health. sleep stage creation to create and add a sleep session to health connect: check that the user has granted the necessary permissions: if (!healthconnectmanager.hasallpermissions()) { showdialoginfo(r.string.permissions_not_granted_api_call) return@launch } define the sleep session start and end time: val starttime = sleepsessiontimerange.startdatetimemillis val endtime = sleepsessiontimerange.enddatetimemillis val timezoneoffset = dateofsleepend.offset to add sleep stage data to the session, create a sleepstage record for each stage var sleepstageslist: arraylist<sleepsessionrecord.stage> val sleepstage = sleepsessionrecord.stage( starttime = sleepstagestart, endtime = sleepstageend, stage = healthconnectmanager.stagetoenummap.getvalue( activitysleepstagesbinding.spinstage.selecteditem.tostring(), ), ) sleepstageslist.add(sleepstage) in health connect manager, create a sleep session record and include the sleep stage list: suspend fun insertsleepsessionrecord( sleepstarttime: instant, sleependtime: instant, timezoneoffset: zoneoffset, stages: arraylist<sleepsessionrecord.stage>, ): boolean { var wasinsertsuccessful = false try { val sleepsessionrecord = sleepsessionrecord( sleepstarttime, timezoneoffset, sleependtime, timezoneoffset, "sleep record sample", "this is a sleep record sample recorded by sleeprecorder app", stages, ) insert the sleep session record into health connect: var wasinsertsuccessful = false try { wasinsertsuccessful = healthconnectclient.insertrecords(listof(sleepsessionrecord)).recordidslist.isnotempty() } catch (e: exception) { log.i(app_tag, "error inserting record: " + e.message) } the sleep session is now in health connect and visible in samsung health after data synchronization. in samsung health, go to the “sleep” screen. the inserted sleep session can be reviewed there with visualizations and analysis just like any other sleep session, such as those tracked on a galaxy watch. below is a sleep session from the sample application: sleep session conclusion this blog has demonstrated how you can develop an application that retrieves data from and inserts data into health connect, making it visible in the samsung health application after data synchronization.
tutorials health, galaxy watch
blogthe galaxy watch running wear os powered by samsung can detect events like hard falls. to detect the hard falls, the watch uses a built-in accelerometer. using the health services api, you can receive a fall detection event in your watch application. in this blog, we create a wear os application to identify a fall detection event and demonstrate how to use the health services api to achieve this on the galaxy watch. the galaxy watch uses the fall detection event in its sos feature. for more information, see use your samsung smart watch in an emergency situation. it can be used to take care of elderly people or patients. how to trigger a fall detection event in your application on the galaxy watch if the functionality provided with the watch is not sufficient for your solution, you can use the health services api to detect this event in your own application. in this section, we describe all the important steps that you must follow when building an events tracking app. as an example, we use the eventsmonitor sample project. project settings before you start writing your code, you need to import the health services api library in the dependencies section of the app/build.gradle file. implementation androidx.health:health-services-client:1.0.0-beta01 now you are ready to use the health services api. get passivemonitoringclient passivemonitoringclient enables tracking of the data in the background (without requiring an ongoing workout) and the events that can occur. you need to get this client to make your application suscribe to the events. private var healthservicesclient: healthservicesclient private var passivemonitoringclient: passivemonitoringclient init { healthservicesclient = healthservices.getclient(context) passivemonitoringclient = healthservicesclient.passivemonitoringclient } ask for permissions in the first step, you need to modify the androidmanifest.xml file. add the <uses-permission> element in the global section: <uses-permission android:name="android.permission.activity_recognition" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <uses-permission android:name="android.permission.foreground_service" /> add the <queries> element: <queries> <package android:name="com.google.android.wearable.healthservices" /> </queries> it is a good practice to ask for the required permissions whenever the application tries to use this data type. first, you should check whether the user has consented to use the particular functionality. permissiongranted = applicationcontext.checkselfpermission( manifest.permission.activity_recognition) == packagemanager.permission_granted if not, you must ask for it before using the api. private fun requestpermissions() { permissionlauncher.launch(android.manifest.permission.activity_recognition) } to ask about permissions, you need to create a request permissions object. permissionlauncher = registerforactivityresult(activityresultcontracts.requestpermission()) { result -> permissiongranted = result } this is an example of a permission request window: using health services api to get events to asynchronously receive information about a fall detection event, provide the class which inherits from the passivelistenerservice class and override the onhealtheventreceived method. class passivehealtheventservice : passivelistenerservice() { override fun onhealtheventreceived(event: healthevent) { runblocking { log.i(tag, "onhealtheventreceived received with type: ${event.type}") healthservicesmanager.getinstance(applicationcontext).recordhealthevent(event) super.onhealtheventreceived(event) } } } add information about this class with the permissions to the androidmanifest.xml file. <service android:name=".passivehealtheventservice" android:exported="true" android:permission="com.google.android.wearable.healthservices.permission.passive_data_binding" /> when you have the passivemonitoringclient and passivehealtheventservice classes, you can then subscribe to the events. private val healtheventtypes = setof(healthevent.type.fall_detected) suspend fun registerforhealtheventsdata() { log.i(tag, "registering listener") val passivelistenerconfig = passivelistenerconfig.builder() .sethealtheventtypes(healtheventtypes) .build() passivemonitoringclient.setpassivelistenerserviceasync( passivehealtheventservice::class.java, passivelistenerconfig ).await() registered = true } if you no longer want to receive information about the fall detection event, please unregister your application from the service. this can be done using the passivemonitoringclient api. suspend fun unregisterhealtheventsdata() { log.i(tag, "unregistering listeners") passivemonitoringclient.clearpassivelistenerserviceasync().await() registered = false } the healthevent class contains information about the event, such as: type - returns the type of the event (fall_detected, unknown). instant - returns the time of the health event. datapointcontainer - returns the metrics associated with the event. test application on the galaxy watch you can test this functionality in the following two ways: manual test you can simulate a fall by trying to fall on a mat. notebefore performing the manual test, ensure that you have taken all safety precautions for yourself. for example, use cushions to soften the fall impact, etc. use synthetic data testing is available on an emulator. use the command line to run and execute commands for synthetic data generation. for more details about this feature, see simulate sensor data with health services. with adb, you can send subsequent commands to the device. notethis blog is based on wear os 4. you can check your watch’s wear os version in galaxy watch > settings > about watch > software information> wear os version. for testing on wear os 3, see more information here. to start the synthetic data generation, run the following command: $ adb shell am broadcast \ -a "whs.use_synthetic_providers" \ com.google.android.wearable.healthservices to simulate a fall, run the following command: $ adb shell am broadcast \ -a "whs.fall_over" \ com.google.android.wearable.healthservices when the tests are finished, to switch back to using real sensors, run the following command: $ adb shell am broadcast \ -a "whs.use_sensor_providers" \ com.google.android.wearable.healthservices resources this blog is based on the eventsmonitor application. the whole presented code comes from this application. the entire application can be downloaded from: eventsmonitor version 1.0 (86,0kb) dec 12, 2022 enjoy your adventure creating the ultimate health application now you are ready to start the fall detection event in your application. we encourage you to try doing it by yourself and explore other features provided by the health services sdk.
Samsung Developers
tutorials health, galaxy watch
blogthe body composition measurement is one of the powerful features of samsung galaxy watch. it is an important metric of your overall health. the body composition measurement data is displayed in the samsung health application on the galaxy watch and a compatible smartphone. in this article, we show you how to read the galaxy watch’s body composition data using the android health connect api in a sample application named "bia viewer". you can download the code for this sample application from the link at the bottom of this blog. bia is an abbreviation for bioelectrical impedance analysis, and the bia data measures body composition data. notethe body composition measurement feature is available on galaxy watch4 series and later models. installing health connect api the android health connect api provides interfaces for reading and writing your health and fitness data. the samsung health application exchanges data with the health connect api. for more information, see accessing samsung health data through health connect. notesynchronization of data between the samsung health application and the health connect api is supported on samsung health v6.22.5 and later. measuring body composition with galaxy watch as the first step in developing your ultimate health application, you must collect the body composition data using the samsung health application in galaxy watch. steps to measure bia with galaxy watch: start the samsung health application. ensure that the galaxy watch is worn tightly on your wrist. raise your arms so your armpits are open. place your middle finger on the 2 o’clock key and ring finger on the 4 o’clock key on the watch. touch your watch only. don’t let your hand on the watch’s keys touch your arm or other hand on the watch. maintain the finger positions on the galaxy watch dial until the measurement is completed. example of a result obtained by measuring body composition with the samsung health application: after the bia measurement is completed on the galaxy watch, the data can be synchronized with the samsung health application. synchronizing data with the health connect application once you have data in the samsung health application, it is synchronized with the health connect application. synchronized body composition data can be found directly in the health connect application. basal metabolic rate body fat height weight bia viewer application overview bia viewer is an application that reads the body composition data collected by the samsung health application with the health connect apis. by default, this application loads the data during startup. however, you can manually reload the data using the “refresh” button. the bia viewer application reads the body composition data such as weight, height, body fat, basal metabolic rate. the user's height is not displayed and is only used to calculate bmi. the step-by-step construction of the most important elements of the application are described in the next sections. note fat mass is calculated using the formula: [fat mass] = [body fat] * [weight] / 100 bmi is calculated using the formula: [bmi] = [weight] / ([height]* [height]) adding health connect api to your project before you start writing your code, you need to import and add the health connect api library to the file application/build.gradle in the dependencies section. implementation 'androidx.health.connect:connect-client:1.1.0-alpha06' now you are ready to use the health connect api. checking health connect availability on your device at the beginning of your application, it's a good idea to ensure that the device running your application actually supports the health connect api library. the library is available only when the health connect application is installed on the device. notesince android 14 health connect is part of the system and is installed by default. however in earlier versions, it's necessary to check, if health connect is present on the device. private fun checkavailability(): boolean { when (healthconnectclient.getsdkstatus(this)) { healthconnectclient.sdk_unavailable -> { //error message – unable to install health connect } return false } healthconnectclient.sdk_unavailable_provider_update_required -> { //error message – health connect not present on device, but can be installed } return false } else -> { return true } } } get healthconnectclient before going to the next step, you need to get healthconnectclient. healthconnectclient is an entry point to the health connect api. healthconnectclient automatically manages its connection to the underlying storage layer and handles all ipc and serialization of the outgoing requests and the incoming responses. private val healthconnectclient by lazy { healthconnectclient.getorcreate(context) } ask for permissions in the first step, you need to modify the androidmanifest.xml file. add <intent-filter> in the <activity> section: <intent-filter> <action android:name="androidx.health.action_show_permissions_rationale" /> </intent-filter> add <activity-alias> element required in android 14: <activity-alias android:name="viewpermissionusageactivity" android:exported="true" android:targetactivity=".mainactivity" android:permission="android.permission.start_view_permission_usage"> <intent-filter> <action android:name="android.intent.action.view_permission_usage" /> <category android:name="android.intent.category.health_permissions" /> </intent-filter> </activity-alias> add <uses-permission> elements: <uses-permission android:name="android.permission.health.read_basal_metabolic_rate" /> <uses-permission android:name="android.permission.health.read_body_fat" /> <uses-permission android:name="android.permission.health.read_height" /> <uses-permission android:name="android.permission.health.read_weight" /> add <queries> elements: <queries> <package android:name="com.google.android.apps.healthdata" /> </queries> to start the request permissions from your application, first build a set of permissions for the required data types. make sure to only ask for permissions mentioned in the manifest file. val permissions = setof( healthpermission.getreadpermission(basalmetabolicraterecord::class), healthpermission.getreadpermission(bodyfatrecord::class), healthpermission.getreadpermission(heightrecord::class), healthpermission.getreadpermission(weightrecord::class), ) it is a good practice to ask for the required permissions whenever the application tries to use this data type. first, you should check whether the user has consented to use the particular functionality. suspend fun hasallpermissions(): boolean { return healthconnectclient.permissioncontroller.getgrantedpermissions() .containsall(permissions) } if not, you should ask for it before using the api. private fun checkpermissions() { lifecyclescope.launch { if (healthconnectmanager.hasallpermissions()) { readalldata() } else { requestpermissions.launch(healthconnectmanager.permissions) } } } to ask for permissions, you need to create a request permissions object. private fun createrequestpermissionsobject() { requestpermissions = registerforactivityresult(healthconnectmanager.requestpermissionactivitycontract) { granted -> lifecyclescope.launch { if (granted.isnotempty() && healthconnectmanager.hasallpermissions()) { toast.maketext( this@mainactivity, r.string.permission_granted, toast.length_short, ).show() } else { alertdialog.builder(this@mainactivity) .setmessage(r.string.permission_denied) .setpositivebutton(r.string.ok, null) .show() } } } } sample permission request window: creating a query to read body composition data to read data, build the readrecordsrequest object and in the parameters, specify the time range and the data type. then, read the data by passing the readrecordsrequest object as a parameter. after the request is finished, the result contains the list of returned data that you requested. then you go through the list and read individual records. in our example, we will read only the last value. readrecordsrequest example code for weightrecord data type: suspend fun readweight(start: instant, end: instant): double { val request = readrecordsrequest( recordtype = weightrecord::class, timerangefilter = timerangefilter.between(start, end) ) val response = healthconnectclient.readrecords(request) if (response.records.isnotempty()) { val weightrecord = response.records.last() return weightrecord.weight.inkilograms } return 0.0 } list of all the data types used in the application: basalmetabolicraterecord bodyfatrecord heightrecord weightrecord checking query results now you are ready to run the test application on your phone and compare the results of the application with the samsung health application. the application can be tested on the device by running it directly from android studio. the data in both pictures are identical. you were able to successfully recover the data from the samsung health application using the health connect api. resources this blog is based on the bia viewer application. the entire code in this blog comes from this application. the application can be downloaded from: bia viewer version 1.1 (84,0kb) dec 08, 2023 enjoy your adventure creating the ultimate health application now you are ready to start using the samsung health application with the health connect api to enhance the capabilities of your application.
tutorials health
bloghealth connect is a platform that enables you to integrate samsung health data with your applications, creating new opportunities for health applications that enhance the user's journey towards better health. using the health connect apis, you can, for example, retrieve a user's samsung health data, such as their exercise, sleep, and heart rate information, and send data to the samsung health application. this is the first blog post in a series introducing you to the health connect api features and how you can use them in your applications. let's begin by looking at how health connect interacts with samsung health data and the basic workflow. understanding this is essential for creating applications that use data from samsung health and health connect. samsung health samsung health is an application that can be installed on android smartphones and tablets, and on galaxy watches. it can use the sensors on the device, including the galaxy watch's bioactive sensor, to measure the user's overall health data, including steps, exercises, heart rate, sleep, blood oxygen saturation and body composition. the samsung health application is installed on both the galaxy watch and a smartphone. the application synchronizes the measurements between both devices and manages the user's health data securely on them. figure 1: samsung health on galaxy watch and android smartphone health connect since the samsung health application supports various useful health data types and gathers data from all connected devices, developers have been interested in obtaining access to that data. consequently, samsung collaborated with google to build the health connect platform, which was released in may 2022. health connect enables applications to share health and fitness data across android devices with the user's consent. for more information about health connect, see health connect guide and health connect apis. samsung health has supported synchronizing data with health connect since application version 6.22.5, released in october 2022. the health connect apis support devices using android sdk 28 (pie) or higher. notesince android 14, health connect is a system application and is supported by the health connect api versions 1.1.0 and higher. make sure your samsung health application version is up to date, to enable support for the latest health connect features. for more information on health connect as a system application, see: migrate health connect. once the user has connected samsung health to health connect, new or updated data in samsung health is shared to health connect. this means that your applications can use the health connect apis to access samsung health data. samsung health synchronizes health data with health connect in both directions: when samsung health has new or updated data, it writes the data to health connect. when health connect has updated data, samsung health retrieves it. for example, a blood glucose meter connected to samsung health measures the user's blood glucose level. this data is saved in samsung health and then sent to health connect. similarly, whenever there is new blood glucose data in health connect, samsung health retrieves that data and saves it in samsung health. figure 2: accessing samsung health data through health connect to demonstrate how data synchronization works, let's walk through an example of adding nutrition information to samsung health. to start data synchronization between samsung health and health connect, you must enable it in the samsung health application on your android device. from the settings menu, select health connect. if health connect is not installed, you are prompted to install it. the first time you access the health connect menu item in samsung health, tap get started. figure 3: get started screen you are asked to grant permissions to share your samsung health data with health connect. select the data you consent to sharing and tap allow. note“read” and “write” permissions are granted separately. figure 4: data sharing consent samsung health and health connect are now linked and data is shared between them. to test the data synchronization, in samsung health, go to food tracker and create some nutrition data. figure 5: nutrition data input in samsung health, go to settings > health connect, and select data and access. if health connect has received nutrition data from samsung health, a nutrition item appears in the browse data list. figure 6: synchronized nutrition data to view the synchronized data, select nutrition. figure 7: nutrition data in health connect data synchronization timing data synchronization between samsung health and health connect occurs on the smartphone side. to take advantage of health data collected by a galaxy watch, you must understand at which times the galaxy watch sends its data to the samsung health smartphone application. figure 8: data synchronization between watch and smartphone new or updated health data on each connected device is generally synchronized with samsung health in the following situations: the galaxy watch reconnects with the smartphone the user opens the samsung health application home screen on the smartphone the user pulls down on the samsung health application home screen on the smartphone however, some types of health data are synchronized differently: for battery conservation reasons, continuous heart rate data from the galaxy watch is not sent to the samsung health application on the smartphone immediately. however, manual heart rate measurements on the watch are synchronized immediately. enabling settings in samsung health to synchronize health data between samsung health and health connect please consider: using the latest samsung health. if you're interested in galaxy watch's data, check its version too. allowing data permissions through the following path: samsung health > settings > health connect > app permissions > samsung health (note that you must enter from the samsung health settings) synchronizing samsung health data in: samsung health > settings > sync with samsung cloud > switch to 'on'. accessing health connect apis if the user has synchronized their samsung health data with health connect, you can use the health connect apis to interact with it in various ways. for example: read and write data: you can retrieve data that has been shared from samsung health to health connect and send data to health connect to be synchronized to samsung health. delete specific data records: you can remove a specific data point or data of a specific type within a time interval. aggregate and filter data: you can filter the retrieved data by type or tag and analyze it, such as determining the average, maximum, minimum or sum of the values. session data: you can group data into sessions by time interval, such as to generate a sleep or activity session report. notefor security reasons, health connect data can only be retrieved by applications running in the foreground. the following table lists the various health data that can be synchronized between samsung health and health connect. samsung health data corresponding health connect data type all steps stepsrecord blood glucose bloodglucoserecord blood oxygen oxygensaturationrecord blood pressure bloodpressurerecord exercise, session exercisesessionrecord exercise, calories totalcaloriesburnedrecord exercise, distance distancerecord exercise, heart rate heartraterecord exercise, power powerrecord exercise, speed speedrecord exercise, vo2max vo2maxrecord heart rate heartraterecord nutrition nutritionrecord sleep session sleep stage sleepsessionrecord weight weightrecord weight, body fat bodyfatrecord weight, basial metabolic rate basalmetabolicraterecord weight, height heightrecord notesynchronized data scope can be changed depending on the samsung health version. notethe exercise data in the table (total calories burned, distance, power, speed, vo2max) are samsung health exercise tracker's data. samsung health’s activity tracker data are not synchronized to health connect. to get started with implementing health connect api functionality in your application: add the latest version of the health connect api library dependencies to your application's "build.gradle" file, for example: implementation "androidx.health.connect:connect-client:1.1.0-alpha02" declare the health connect application package name in your "androidmanifest.xml" file. check that the user has the health connect application, then create the "healthconnectclient" instance. declare the permissions for the health data types you want to use. now your application is ready to use the health connect apis. other blog posts in this series explore various health connect api use cases in more detail. related blogs reading body composition data with galaxy watch via health connect api
tutorials galaxy watch, marketplace
blogwith the release of one ui watch version 4.5, there are new steps for installing galaxy watch4 and galaxy watch5 watch faces that are different from the previous post on this topic. new and previously purchased watch faces from google play store will not automatically become the active watch face on your watch. in some cases, you must first download watch faces to your play store account before transferring them to your watch. the steps below explain how to install watch faces using your watch, phone, or computer browser. your devices should be logged into the same google account and on the same wifi to ensure they are correctly connected. new watch faces purchase and install using your watch purchase and install using your phone purchase and install using your computer browser previously purchased watch faces install previous purchase using your watch install previous purchase using your phone install previous purchase using your computer browser troubleshooting getting help new watch faces purchase and install using your watch 1. swipe up on your watch to view your watch apps and tap the play store app. 2. use the search function to find watch faces based on keywords, or scroll down and tap the watch faces banner to view featured watch faces. 3. tap on the chosen watch face. 4. tap on the price button. 5. a notification to complete your purchase on your phone will appear on your watch. if this device appears in the list, the developer offers a companion app for your phone for this watch face. companion apps are not required for watch faces to function correctly on your watch. 6. on your phone, go to the play store. a. tap on your profile icon b. tap on notifications & offers c. tap on continue your purchase to complete the transaction your new watch face will download to your play store account. even though the payment successful notification states that your new watch face is now available on your watch, it still must be transferred to your watch. 7. tap on available on more devices and tap the install button for your watch model. 8. once your watch face downloads to your watch, click on the current watch face, swipe left, and select add watch face. continue swiping left until you see your newly downloaded watch face. finally, tap the watch face to make it your active watch face. purchase and install using your phone 1. open the galaxy wearable app and tap either the watch faces button or the store button to launch the play store. if you tap watch faces, you need to scroll to the bottom and select get more watch faces to launch the play store. 2. if you arrive at the play store home screen, you must navigate to the watch face page. tap either the featured watch faces banner or scroll to the bottom and tap watch faces to open the watch face page. alternatively, you can open the play store on your phone but must tap the categories tab near the top and select the watch faces category. 3. navigate through the many options of watch faces within different categories, or use the search function to search using a keyword. 4. select a watch face and tap the dropdown arrow button in the green price bar. if the dropdown doesn't appear, confirm that your phone and watch are connected, then close and re-open the play store app on your phone. you may also need to turn off the wifi on your watch and then turn wifi back on. 5. tap on the checkmark box for your watch to select it, then tap on the green bar app price. 6. add payment information if needed or redeem a coupon code by tapping on the current payment choice, scrolling down, and selecting redeem code. 7. tap on the 1-tap buy green bar button to complete your purchase. your watch face downloads to your phone and then installs on your watch. downloading may take several minutes, and the status may not change from install pending. 8. you can check the progress of your download by tapping the download icon at the bottom of your current watch face. some purchases may take several hours to sync with your watch. if you have initiated your purchase using your phone, do not attempt to purchase again using your watch. 9. once your watch face has downloaded to your watch, make the watch face your active watch face by going to the galaxy wearable app on your phone and select watch faces. 10. scroll down to the downloaded category and tap on your recently downloaded watch face to add it to your favorites category. 11. your watch face will now be the active watch face on your watch. purchase and install using your computer browser 1. go to https://play.google.com/store/apps and ensure you signed in to your google account associated with your phone. 2. click on the watch category button near the top of the page. 3. click on the featured watch faces banner. 4. navigate through the many options of watch faces within different categories or use the search function to search a keyword. 5. once you have chosen a watch face, click the green buy button and complete your purchase. 6. to transfer your watch face to your watch, select your watch model from the choose a device dropdown and then click install. installing may take several minutes to complete. 7. after your watch face downloads to your watch, click on the current watch face, swipe left, and select add watch face. continue swiping left until you see your newly downloaded watch face. finally, tap the watch face to make it your active watch face. install a previously purchased watch face if you would like to install a watch face that you had previously purchased from the play store, there are different ways you can do this using your watch, your phone, or your computer. install previous purchase using your watch 1. swipe up on the current watch face to access the watch apps and select the play store app. you can also press and hold on to the current watch face, swipe left to the end of the list and select add watch face. continue swiping left until the end and select more watch faces. the play store app will launch. 2. tap the search icon and talk, draw, or type the name of the watch face. 3. select the watch face and tap install. 4. once your watch face downloads to your watch, click on the current watch face, swipe left, and select add watch face. continue swiping left until you see your newly downloaded watch face. finally, tap the watch face to make it your active watch face. install previous purchase using your phone 1. to install a previously purchased watch face using your phone, open the galaxy wearable app and tap either the watch faces button or the store button to launch the play store. if you tap watch faces, you need to scroll to the bottom and select get more watch faces to launch the play store. alternatively, you can directly open the play store by tapping the app icon on your phone. 2. once the play store app has opened, you can view all previously downloaded watch faces by tapping your google account profile icon and selecting manage apps & device. 3. tap on the manage tab and scroll to find the apps for the watch faces you have installed on your phone. 4. select the green installed button and change it to not installed to view apps previously downloaded but not currently installed on your phone. you can also tap the search icon and type the name of your previously purchased watch face. 5. tap on the watch face app from the results list you would like to install on your watch. 6. tap the small downward triangle to open the install options. place a checkmark next to your watch model and click the install button. 7. once your watch face downloads to your watch, click on the current watch face, swipe left, and select add watch face. continue swiping left until you see your newly downloaded watch face. finally, tap the watch face to make it your active watch face. install previous purchase using your computer browser 1. go to https://play.google.com/store/apps and sign in to your google account associated with your phone. 2. click on your profile icon and select library & devices. 3. scroll through the list of previously downloaded apps and select one of your watch faces. if needed, click show more to view your full list of apps. 4. click on the green install on more devices button. 5. in the drop-down menu, click on the device list and select your galaxy watch. 6. click the green install button to install the watch face to your galaxy watch. enter your google account password if asked. 7. your watch face will begin to download to your watch. 8. once your watch face downloads to your watch, click on the current watch face, swipe left, and select add watch face. continue swiping left until you see your newly downloaded watch face. finally, tap the watch face to make it your active watch face. troubleshooting when downloading a watch face to your watch, if your watch device is not showing in the install on more devices list, you will need to use a computer browser to re-install the watch face. 1. log into your play store account and use the search function to find your watch face. 2. click on install on more devices. 3. select your watch model and click install. 4. your watch face will begin to download to your watch. 5. once your watch face downloads to your watch, click on the current watch face, swipe left, and select add watch face. continue swiping left until you see your newly downloaded watch face. finally, tap the watch face to make it your active watch face. getting help for questions about using your watch, open the samsung members app on your phone to visit the community forum. then, view the galaxy watch forum in the wearables category to read discussions and post your questions. to participate in the broader wear os discussion, visit the wear os by google help community page. grow your watch face collection as you can see, there are many ways that you can purchase and install watch faces in google play store onto your galaxy watch. personalization is a key feature of your galaxy watch, and we know you will continue to enjoy customizing the look of your watch style as you grow your collection of watch faces. visit the play store to find your next favorite wear os powered by samsung watch face. to view the watch faces featured in this blog, search the play store for the designer monkey's dream. resources for sellers at samsung galaxy store for more information on signing up and selling on galaxy store, look into the galaxy store documentation. for assistance with setting up and starting your sales campaigns, the galaxy store discussion forums are where you can get great insights from the galaxy store support team and other sellers. join us on twitter, facebook, linkedin, and youtube to continue the discussion.
Tony Morelan
tutorials galaxy watch, mobile, marketplace
blogupdated 15 november 2022 this article was written for galaxy watch4 and one ui 4.0. the installation process for galaxy watch5 and one ui 4.5 has changed for several of these workflows. we've written a newer article specifically for the newer devices. if you have a galaxy watch5, please use these instructions. with the release of wear os powered by samsung and the galaxy watch4, purchasing and installing google play store watch faces can be done in different ways. i will cover using your watch, your phone, or your computer to install at time of purchase and installing previously purchased watch faces. purchase and install using your watch purchase and install using your phone purchase and install using your computer browser install previous purchase using your watch install previous purchase using your phone install previous purchase using your computer browser getting help for hands-on instructions showing the different ways you can purchase and install watch faces, be sure to check out my video tutorial. purchase and install using your watch press and hold on your current watch face, then swipe left or rotate your bezel to the right and select more watch faces. scroll through the list of featured watch faces and select one of your choice or tap the search icon and enter in a keyword to search all published watch faces. click the price button and complete your purchase by opening the play store notifications on your phone. purchase and install using your phone open the galaxy wearable app and tap either the watch faces button or the store button to launch play store. if you tapped watch faces, you need to scroll to the bottom and select get more watch faces to launch the play store. the watch face category on the play store app will load. navigate through the many options of watch faces within different categories, or use the search function to search using a keyword. alternatively, you can open play store on your phone but must either tap the featured wear os banner to open the watch face category, or tap the back button in the top left corner to go to the main page, then tap the categories tab and select the watch faces category. navigate through the many options of watch faces within different categories or use the search function to search a keyword. select a watch face and tap on the green bar dropdown arrow button. next, tap on the box for your watch to place a checkmark in it, then tap on the green bar app price. if your phone appears in the list, this means that a companion app for your phone is offered by the developer for this watch face. companion apps are not required for watch faces to function properly on your watch. if you place a checkmark next to your phone, the companion app also installs on your phone. if a companion app for your phone is not offered, you see this phone isn’t compatible with this app. in this case, only the watch face installs on your watch. add payment information if needed or redeem a coupon code by tapping on the current payment choice and then scroll down to select redeem code. tap on the 1-tap buy green bar button to complete your purchase. your watch face downloads to your phone and then installs on your watch. this may take several minutes and the status may not change from installing soon. simply check your watch by pressing and holding on the current watch face and swipe to the right to see that your new watch face has been successfully installed. purchase and install using your computer browser go to https://play.google.com/store and click on apps in the sidebar. select the categories tab and then select watch faces from the dropdown menu. navigate through the many options of watch faces within different categories or use the search function to search a keyword. once you have chosen a watch face, click the green buy button and complete your purchase. to install your watch face, select your watch model from the choose a device dropdown and then click install. this may take several minutes to complete. install a previously purchased watch face if you would like to install a watch face that you had previously purchased from the google play store, there are different ways you can do this using your watch, your phone, or your computer. install previous purchase using your watch swipe up on the current watch face to access the watch apps and select the play store app. you can also press and hold on the current watch face, swipe left until the end of all watch faces, and tap more watch faces. tap the search icon and talk, draw, or type the name of the watch face. select the watch face app and tap install. once your watch face has downloaded, click on the current watch face and swipe right to select the newly downloaded watch face. install previous purchase using your phone to install watch faces using your phone, open the galaxy wearable app and tap either the watch faces button or the store button to launch play store. if you tapped watch faces, you need to scroll to the bottom and select get more watch faces to launch the google play store. alternatively, you can directly open play store by tapping the app icon on your phone. once the play store app has opened, you can view all previously downloaded watch faces by tapping on your google account profile icon and then selecting manage apps & devices. tap on the manage tab and scroll to find the apps for the watch faces you had previously purchased. you can also tap the search icon and type the name of your previously purchased watch face. the app shows that it is installed, meaning it is installed on the phone but not necessarily on your watch. tap on the watch face app from the results list that you would like to install on your watch. tap available on more devices to expand your list of devices. if you don’t see available on more devices, tap the back button and try opening the watch face app again. tap install next to your watch model name. installing soon is then displayed. if you would like to see the install percentage for your watch face, swipe right on your watch. once the install has been completed, press and hold on your current watch face then swipe right to find your newly installed watch face. tap to install. install previous purchase using your computer browser go to https://play.google.com/store/apps and make sure you are signed in to your google account associated with your phone. in the left sidebar click on my apps and select a watch face to open. click on the green installed button. click on the device list and select your galaxy watch. click the green install button to install the watch face to your galaxy watch. getting help for questions about using your watch, open the samsung members app on your phone to visit the community forum. you can visit the galaxy watch forum in the wearables category to read discussions and post your own questions. to participate in the broader wear os discussion, visit the wear os by google help community page. grow your watch face collection as you can see, there are many ways that you can purchase and install watch faces from play store onto your samsung galaxy watch4. personalization is a key feature of your watch4 and we know you will continue to enjoy customizing the look of your watch style as you grow your collection of watch faces. visit play store to find your next favorite wear os powered by samsung watch face. to view the watch faces featured in this blog, search the google play store for the designer monkey’s dream.
Tony Morelan
events mobile, foldable
blogyes, samsung's unpacked august 2022 is happening! livestream the event wed, aug 10th at 9am et/6am pt on samsung.com and samsung's youtube channel. here's what to expect: announcements about the samsung galaxy z fold4, galaxy z flip4, and galaxy watch5. plus, reserve yours before august 10th and get a $100 samsung credit for a galaxy smartphone or a $200 samsung credit for a galaxy smartphone bundle. last year, samsung shipped nearly 10m foldable smartphones worldwide, which was a 300%+ increase from 2020. foldables are definitely going mainstream and gaining a larger share of the overall smartphone market. according to dr. tm roh, president and head of mx business, samsung electronics, the foldable form factor is now the preferred choice for millions. this unpacked announcement will focus on foldables being the optimal tool for productivity and creative expression. mark your calendar to be part of unpacked aug 10, 2022; livestream the event at 9am et/6am pt, on samsung.com and samsung's youtube channel. developer content we've also been busy creating technical content about foldables for developers. foldables podcast with guests from microsoft, google, and samsung (season 3, episode 7) guy merin (microsoft), ade oshineye (google), and søren lambæk (samsung) discuss foldable trends and how companies are working together to help developers create for this new and innovative technology. follow along in our code labs and tutorials about foldables. boost your apps' value with foldable and large screen optimization discover more about implementing, optimizing, and testing your apps on galaxy z devices. this foldables and large screens page is a collection of code labs, blogs, and docs that you can review at your own pace. how to use jetpack windowmanager in android game dev - code lab with the increasing popularity of foldable phones such as the galaxy z fold3 and galaxy z flip3, apps on these devices are adopting foldable features. in this blog, you can get started on how to use foldable features on android game apps. develop a camera web app on foldables - code lab learn to develop a camera web application that detects partially folded postures and adjusts its layout accordingly to improve the user's experience on samsung foldable devices. companion blog to the camera web - tutorial (spanish version here) follow along with laura morinigo, web developer advocate, samsung, as she guides you step-by-step on how to create a web app for a foldable device when the device changes postures. she also gives a tech talk: unfolding the future of response web design (from sdc 21). how to test your mobile apps through a web browser -- video tutorial don't have a foldable device to do your development and testing? you can use the remote test lab, it's free! additional resources on the samsung developers site the samsung developers site has many resources for developers looking to build for and integrate with samsung devices and services. stay in touch with the latest news by creating a free account and subscribing to our monthly newsletter. visit the galaxy store games page for information on bringing your game to galaxy store and visit the marketing resources page for information on promoting and distributing your android apps. finally, our developer forum is an excellent way to stay up-to-date on all things related to the galaxy ecosystem.
Jeanne Hsu
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 148 0 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 will display as on the image below afterwards, developer options will 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 will 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 on your watch go to settings > apps > health platform quickly tap health platform title for 10 times this enables developer mode and displays [dev mode] below the title to stop using developer mode, quickly tap health platform title for 10 times to disable it start your project in android studio and 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 ; } 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 will find an additional unit tests package this will let 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 skintemptrackin" 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 data from the body sensors afterwards, the screen shows the application tap the measure button to get your skin temperature to stop measuring, 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 skin temperature by yourself! if you are having trouble, you may download this file skin temperature tracking complete project 147 8 kb to learn more about samsung health, visit developer samsung com/health
tutorials galaxy watch
blogwatch face studio is a graphic authoring tool that helps you to design watch faces for the wear os smartwatch ecosystem, including galaxy watch4 and galaxy watch5. it is an intuitive graphic tool which allows you to design watch faces without coding. watch face studio includes a notable feature known as a complication. using complications, the user can get a glanceable unit of information for their selected application on their watch face. the complications can display data, such as text, title, image, or icon, which is collected from the applications that provide such information. today, i discuss some complication features in this blog. i design a simple watch face to demonstrate these. for simplicity i add a digital time and a digital date. for complications, i add one short text complication and one ranged value complication. at the end, two different theme colors are applied. you can download this sample design from here and throughout this blog you can follow me. after deploying the watch face on a watch and customizing the complication, the watch face on the real device looks the same as figure 1. figure 1: the watch face demonstrated in this blog getting started to view and deploy the sample design from my blog, watch face studio must be installed on your pc. now , i create a new project and then add basic components for simplicity. i add time and date from digital clock and place them in the center. adding complications as i have said earlier, i use two different complications in this design. to add complications, go to the add component menu on the top middle. from the dropdown menu, add the "short text" complication. for more information about complications, visit this complication document. short text complication first, i add a short text complication. for design purposes, i adjust the complication placement as (x and y) 170 and 45. i leave the dimension and color as it is. however, you can resize the dimension and change the color of the components of the selected complication. now i set the properties of complication settings as follows: complication type: i set it as "editable" so that anyone can customize the complication from their watch. if the type is set as "fixed," then the complication cannot be customized from the watch and it remains the same as what is provided in the design. for example, i choose "sunrise sunset" from the default provider > dropdown menu (see figure 2a). if the default provider is set as > "empty," no complication is displayed in the run window. note : if the default provider is set as "empty," customization from the watch is still possible. complication layout: the layout for this complication is set to the default ("icon + text + title"), but the layout also can be changed to the designer's preference. in figure 2b, the other layout options for the short text complication are displayed. you can find more details about the complication layout from my things to consider when designing complication layouts blog. (a) default provider options (b) layout options figure 2: complication settings ranged value complication now, i add a ranged value complication and adjust the properties as displayed in figure 3. i select the default provider as "watch battery" for this complication. i set the complication type to "fixed" so that the customization from the watch is not possible. figure 3: ranged value properties, "watch battery" is fixed and cannot be changed on the watch for this complication watch face studio gives the opportunity to change the properties for every component of the complication. now, i modify the properties of the progress bar component of the ranged value complication. so, at first, i expand the ranged value complication. an example of this is displayed in figure 4. figure 4: expand the ranged value complication to change the properties, i click on the progress bar under the ranged value complication to display its properties. i change the color of the progress bar by following the steps below: a. click the color box in the color menu. b. select a color from the color picker pop-up window. c. click ok in the color picker pop-up window. figure 5: ranged value progress bar color change figure 6: ranged value complication added i have added two complications in two different positions on the watch face. keep in mind that currently, only one complication can be set in one spot. so only one complication must be set in the same area regardless of normal or always-on-display (aod). for example, i add two same or different complications in the same position. i set one complication for normal mode and another complication for aod mode. now, i can set two different complication providers and test them on the run window for the normal and aod modes. but it is not possible to customize both the complications on the watch as the complications overlap each other. therefore, it is better not to use two complications in one spot. adding a theme color to a complication now, i add two theme colors and apply one of them to the short text complication. the steps to add and apply a color are given below: a. go to the style tab. the tab contains the theme color palette menu to choose the theme color**.** b. add a color by clicking the "+" icon. c. the color picker pop-up window opens. select a color from the available options. d. click ok for confirmation. note : you can add as many colors as required by repeating steps a to d. e. now set the theme color for the short text complication. a "fill with color" icon is present for every selected component. click the fill with color icon for the short text complication title, text, and the icon. f. on the run window, the theme color menu is displayed which contains all the selected theme colors from the style tab. choose any color by selecting the checkbox and view the output in the run preview. g. for the short text complication, the theme color is set and the color for the title, text, and icon is changed. figure 7: add theme color for short text complication note : the theme color can be customized from the watch. theme color on a watch on the watch, i can choose a theme color from the available colors that i had added in the project earlier. the theme color is set on every component of the short text complication. however, in the case of the icon and image of the complication, the theme color is applied after converting the original color to grayscale. this is because we do not know the color that is provided by the complication provider. that is why it is converted into grayscale first, before applying the theme color. so be careful about setting the theme color while designing your watch face, as the icon and image colors may interfere with the theme color. for example, from the watch, if i set a short text complication as "sunrise sunset," the icon color of this complication is orange (for sunset). on the other hand, if i set the complication as "weather," the icon color is white. see figure 8 for better understanding. in figure 8a, the icon color for "sunrise sunset" is orange and this color is provided by the provider. therefore, if i apply the theme color on this icon, the icon color is not the exact same theme color as displayed in figure 8b. in another scenario, the provided icon color is white which is as displayed in figure 8c. in this case, if the theme color is applied on the icon, the color is perfectly changed as the theme color. in figure 8d, this case is displayed. (a) "sunrise sunset" complication icon without theme color (b) "sunrise sunset" complication icon after applying theme color (c) "weather" complication icon without theme color (d) "weather" complication icon after applying theme color figure 8: the icon color interference with the theme color deploying the design and customizing complications as your own our target components are added. to view the watch face featured in this blog, download this file and deploy it to your watch by following these steps: connect your watch to watch face studio. for information about connecting, see connection guideline. deploy the design on your watch using run on device. for more details on connection, visit this test guideline. note : as per faq 12, "debug over bluetooth" is not yet supported in galaxy watches with galaxy wearable. 3. customize the complications on the watch. figure 9: designed watch face on a watch figure 9 displays the customized complications. to learn more about complications, visit watch face complications. conclusion as you can see, using complications, you can get detailed information for the selected application on your watch. personalization is a key feature of galaxy watch. you can continue to enjoy customizing the look of your watch style as you develop your collection of watch faces. resources in the samsung developer forum, you can ask and get help for any issue. this is a very active and friendly community where developers discuss their issues. there are many blogs on different topics, including watch face studio, on the samsung developers site. please visit these galaxy watch tutorials to expand your knowledge about samsung galaxy watch and their special features. if you want to develop watch faces programmatically, you can use android studio. you can do more complex operations using the complication api.
Most Fowziya Akther Houya
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.
These cookies gather information about your browser habits. They remember that you've visited our website and share this information with other organizations such as advertisers.
You have successfully updated your cookie preferences.