공부/Android

[Watch] 헬스 데이터 사용법 조사..

데자와 맛있다 2023. 8. 20. 18:45

이번 프로젝트는 기다리고 기다리시던~~ 헬스 데이터 사용하기! 이걸위해 워치도 하나 장만했다

문제는 내가 헬스데이터를 어떻게 가져와야하는지 전~혀 모른다는거~ 근데 뭐... 헬스 데이터 사용하는 앱 잇는거 보면 가능하지 않을까 ^.< 라는 나의 추측 ㅎ.ㅎ; 어쨌든 지금 되게 만들어야한다 어떻게든 되게만들어야함!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

일단 알아본거

 

1. 삼성의 sdk쓰기

코드 랩 | 삼성디벨로퍼 (samsung.com)

 

Samsung Developers

The world runs on you.

developer.samsung.com

이런 코드랩이 있다

 

2. health platform api 

이 api는 현재 새로운 health connect라는게 생겨서 유지보수 중단되었다고한다

 

3. health connect

구글에서 새로만든? 그런거같음

근데 이 친구는 문제가 얘를 쓸라면 구글 헬스커넥트 앱을 설치를 해야 연동이 가능하다 그래서 사용자 입장에서는 앱을 두개 깔아야된다............................................................................ㅠㅠ

 

4. 삼성 헬스 스택

삼성에서 작년인가? 암튼 최근에 만든 헬스케어 관련 오픈소스,.. 

https://s-healthstack.io/

 

What is Samsung Health Stack? | Samsung Health Stack

Samsung Health Stack is an open-source technology stack offering end-to-end solutions for collecting and analyzing data from wearable devices in Android and Wear OS environments. With applications ranging from medical research to clinician services and bey

s-healthstack.io

https://developer.samsung.com/health/s-healthstack

 

Samsung Health Stack | Samsung Developers

Experience the Health Services to create a useful health app on Galaxy Watch and a smartphone.

developer.samsung.com

https://s-healthstack.io/tutorial.html

 

Full-Stack Tutorial | Samsung Health Stack

Warning: Documentation for v1.0 official release is currently under construction. Note that the information on this page may be outdated. This getting started tutorial describes the steps you need to be up and running with your own study using the full Sam

s-healthstack.io

 


1. 삼성에서 제공하는 sdk 사용

이거는 하.. ㅋㅋ 코드랩 구경해봣는데

Galaxy Watch에서 혈중 산소 수치 및 심박수 측정 | 삼성디벨로퍼 (samsung.com)

 

Measure Blood Oxygen Level and Heart Rate on Galaxy Watch | Samsung Developers

Create a health app for Galaxy Watch, operating on Wear OS powered by Samsung, utilizing the new Samsung Privileged Health SDK to trigger and obtain results of simultaneous blood oxygen level (SpO2) and heart rate measurements.

developer.samsung.com

모의 라이브러리를 코드랩에서 사용할수있고 진짜 찐 데이터 사용하려면 파트너쉽을 맺어야된단다 

싸피니깐 어케좀 안되나 ㅎㅎ; ;; ;;  ;

뭔 제휴를 맺으라는데 .... 일단 이 방법은 패스 해야될것같다.. 자료도 java 이기도하고 ..

 

2. health platform api

https://github.com/android/health-samples/tree/main/health-platform-v1/HealthPlatformSample

여기보면 health platform api 와 health connect 둘다 예시가 있다

근데 health platform 은 2022년 11월 부터 지원이 중단되었고 health connect로 대체되었다니까 쓸라면 health connect쓰는게 낫지 않을까

https://developer.android.com/training/wearables/health-services/health-platform?hl=ko 

 

Health Platform API  |  Android 개발자  |  Android Developers

Health Platform API 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 참고: Health Platform API 버전 1은 삼성 헬스에서 지원되고 삼성 헬스와 호환되며 일부 삼성 기기

developer.android.com

 

3. health connect

https://charlie-dev.tistory.com/14

 

[Android] Google Health Connect

[주의] 본 게시물은 지극히 주관적인 견해가 담겨 있음을 알립니다. 잘 못된 정보를 포함 할 수 있으며 태클은 감사히받겠습니다. 댓글로 알려주시면 감사하겠습니다. [번역] Google Chrome 번역기 20

charlie-dev.tistory.com

https://developer.android.com/guide/health-and-fitness/health-connect?hl=ko 

 

헬스 커넥트  |  Android 개발자  |  Android Developers

헬스 커넥트 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 헬스 커넥트는 건강 및 피트니스 앱이 통합 생태계 내에서 동일한 기기 내 데이터를 사용할 수

developer.android.com

제공하는 데이터는 이와같다

https://developer.android.com/guide/health-and-fitness/health-connect/frequently-asked-questions?hl=ko#request-access 

 

자주 묻는 질문(FAQ)  |  Android 개발자  |  Android Developers

자주 묻는 질문(FAQ) 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. Q: 헬스 커넥트는 Android 플랫폼에서만 사용할 수 있나요? A: 예. Health Connect API와 헬스 커넥

developer.android.com

 

헬스커넥트는 health services api를 사용하는 wear os 에서 사용 불가하다

헬스커넥트는 android 9 (api28)이상부터 적용가능하다

구글 play 서비스가 설치되어야 하는 등 특정 호환성 요구사항이 있다(애플은 안된다~)

헬스커넥트sdk 는 오직 코틀린으로만 사용가능하다

첫 권한 요청 전의 최대 30일 전까지의 데이터만 읽는것이 가능하다

 

Health Connect SDK 자체는 android 8 부터 지원되는데 얘를 쓸라면 꼭 있어야되는 헬스커넥트 앱이 android9 부터 지원되므로 사실상 health connect 는 android 9 부터 쓸수있다고 보면된다

1. SDK

health connect sdk를 의미하는듯

얘를 쓰면 클라이언트앱(=우리가 개발해야되는 앱)이 IPC를 통해 헬스커넥트 apk와 통신할수있다

(워치에서 직접 바로 데이터를 가져오는게 아니라 워치->헬스커넥트앱->우리의 앱 이런식인듯)

 

2. 클라이언트 앱

우리의 앱

 

3. 헬스 커넥트 apk

헬스 커넥트 앱, health connect api의 핵심이다

권한 관리 및 데이터 관리 구성요소를 모두 포함한다

이 앱은 사용자가 직접 기기에서 사용할수있다.

 

4. 권한 관리

헬스 커넥트에 사용자 인터페이스가 포함되어있다 

더보기

https://developer.android.com/guide/health-and-fitness/health-connect/platform-overview/developer-functionality?hl=ko 

 

개발자 기능  |  Android 개발자  |  Android Developers

개발자 기능 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 다음은 Health Connect API의 주요 기능을 설명합니다. 기록 및 데이터 동기화에 관한 CRUD 작업 플랫

developer.android.com

 

포그라운드에서 실행되는 앱만 헬스커넥트로 데이터를 읽을수있다

중단 없이 앱을 실행하기 위해서는 ForegroundService를 사용

https://developer.android.com/guide/health-and-fitness/health-connect/get-started?hl=ko 

 

시작하기  |  Android 개발자  |  Android Developers

시작하기 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 참고: 헬스 커넥트 UX 가이드라인이 곧 게시됩니다. 사용자를 헬스 커넥트와 통합하는 방법에 관한

developer.android.com

찾아보니 발로소득이라는 앱에서 헬스커넥트로 연동하고있는듯함

https://www.balso.io/#sec02

 

발로소득

발로소득 공식 홈페이지입니다.

www.balso.io

 

설치해보니 걸음수 가져오기 라는 특정 기능에서만 헬스커넥트와 연동되도록 하였음

그래서 걸음수 가져오기 기능 버튼을 눌렀을때 위와 같이 헬스커넥트를 설치하도록 유도하고있다

걸음수 가져오기 버튼을 누르면 앱스토어로 연결되어 설치하도록 만든다

우리는 앱 처음 시작할때 이런식으로 설치 유도를 해야될듯함..

4. samsung health stack

https://s-healthstack.io/tutorial.html

 

Full-Stack Tutorial | Samsung Health Stack

Warning: Documentation for v1.0 official release is currently under construction. Note that the information on this page may be outdated. This getting started tutorial describes the steps you need to be up and running with your own study using the full Sam

s-healthstack.io

https://developer.samsung.com/health/s-healthstack

 

Samsung Health Stack | Samsung Developers

Experience the Health Services to create a useful health app on Galaxy Watch and a smartphone.

developer.samsung.com

https://developer.samsung.com/health

 

Samsung Developers

The world runs on you.

developer.samsung.com

https://r1.community.samsung.com/t5/samsung-health/%EC%82%BC%EC%84%B1%ED%97%AC%EC%8A%A4-api-%EC%97%B0%EB%8F%99-%EA%B4%80%EB%A0%A8-%EB%AC%B8%EC%9D%98-%EB%93%9C%EB%A6%BD%EB%8B%88%EB%8B%A4-%ED%97%AC%EC%8A%A4%EC%BB%A4%EB%84%A5%ED%8A%B8-%ED%8F%AC%ED%95%A8/td-p/22581774

 

삼성헬스 API 연동 관련 문의 드립니다. (헬스커넥트 포함)

안녕하세요, 현재 개발중인 앱에서 웨어러블 디바이스(갤럭시워치 등)에 기록된 신체 계측 정보 (키, 체중, 골격근량, 체수분량, 체지방량 등) 및 활동 데이터 (운동 소모 칼로리, 운동 시간, 운

r1.community.samsung.com

 

5. wear os health service?

https://stackoverflow.com/questions/76710253/confusions-on-reading-health-data-from-wear-os-watch-on-android

 

Confusions on reading Health data from Wear OS watch on Android

I am creating an app for Android phones. I want to read data from Samsung watch 5 in that app. There is a lot of confusion. Should I use Google Fit API OR Health Connect ? I started with "...

stackoverflow.com

근데 이 스택 오버플로우를 보니깐 wear기기에서 바로 데이터 가져오려면 health service를 사용해서 os앱을 먼저 만든 후에 얘한테서 데이터를 받아오라는데?

https://github.com/android/health-samples/tree/main/health-services

이거는 예시

 


https://blog.insilicogen.com/56

 

플러터를 이용한 건강 데이터 추출 및 활용

건강은 우리 삶에 가장 관련이 깊은 키워드 중 하나가 되었습니다. 예전에는 상품이나 제품을 많이 생산하여 소비자에게 공급하였다면 요즘은 개인 맞춤 제품을 적게 생산하여 소비자에게 공급

blog.insilicogen.com

보안 관련한 내용 oauth2발급이 필요하다? 라는데 

 


참고한 블로그

https://goatlab.tistory.com/entry/%EC%82%BC%EC%84%B1-%ED%97%AC%EC%8A%A4-vs-%EA%B5%AC%EA%B8%80-%ED%95%8F

 

삼성 헬스 vs 구글 핏

삼성 헬스 분명히 삼성 에코시스템 (휴대폰 및 웨어러블)이 있다면 Samsung Health 앱을 사용하고 싶을 것이다. 앱은 Samsung 사용자를 위한 Samsung의 앱이다. Samsung Health와 호환되는 기기 목록은 Google Fi

goatlab.tistory.com


결론?

헬스커넥트 예시 앱 뜯어보기

health stack 예시 앱 뜯어보기

5번째 방법 고려하기?

둘중 하나 고르는게 좋을것같음.. 내 생각엔 

일단 팀원이랑 같이 상의하는것도 필요할듯함

아 방법이 너무 많아서 뭐를 골라야될지 모르겠다.. 예시도 별로없고..

이건머... 죄다 걍 테스트단계라서 뭐 확실한게 없는듯? 삼성 sdk 제휴맺는거 말고는 

그래도 방법이 없진 않으니깐 ^^... 희망이있네여