HealthTrackingService
overview package class tree deprecated index com samsung android service health tracking class healthtrackingservice java lang object com samsung android service health tracking healthtrackingservice public class healthtrackingservice extends object healthtrackingservice initiates a connection to samsung's health tracking service and provides an healthtracker instance to track a healthtrackertype public class mainactivity extends activity { private healthtrackingservice healthtrackingservice = null; private healthtracker ecgtracker = null; private final connectionlistener connectionlistener = new connectionlistener { @override public void onconnectionsuccess { // connection with health platform succeeded check capability list<healthtrackertype> availabletrackers = healthtrackingservice gettrackingcapability getsupporthealthtrackertypes ; if !availabletrackers contains healthtrackertype ecg_on_demand { // tracking electrocardiogram ecg on-demand is not available // display a proper message to the user } else { ecgtracker = healthtrackingservice gethealthtracker healthtrackertype ecg_on_demand ; } } @override public void onconnectionended { // the connection with health platform was ended } @override public void onconnectionfailed healthtrackerexception exception { //check the error code and resolve it if exception hasresolution { // display a proper message before calling resolve exception resolve mainactivity this ; // jumping to an application market to install or update health platform } else { // display a proper message for the exception } } } @override protected void oncreate bundle savedinstancestate { // check and request permission if activitycompat checkselfpermission getapplicationcontext , "android permission body_sensors" == packagemanager permission_denied { requestpermissions this, new string[]{manifest permission body_sensors}, 0 ; } try { // connect the health tracking service healthtrackingservice = new healthtrackingservice connectionlistener, context ; healthtrackingservice connectservice ; } catch throwable t { // exception handling } } } since 1 0 0 constructor summary constructors constructor and description healthtrackingservice connectionlistener connectionlistener, context context constructor of healthtrackingservice method summary all methods instance methods concrete methods modifier and type method and description void connectservice establish connection with samsung's health tracking service void disconnectservice release a connection for samsung's health tracking service healthtracker gethealthtracker healthtrackertype healthtrackertype provide a healthtracker instance for the given healthtrackertype healthtracker gethealthtracker healthtrackertype healthtrackertype, set<ppgtype> ppgtypeset provide a healthtracker instance for the given healthtrackertype, and ppgtypeset healthtracker gethealthtracker healthtrackertype healthtrackertype, trackeruserprofile userprofile provide a healthtracker instance for the given healthtrackertype and userprofile healthtracker gethealthtracker healthtrackertype healthtrackertype, trackeruserprofile userprofile, exercisetype type provide a healthtracker instance for the given healthtrackertype, userprofile and type healthtrackercapability gettrackingcapability provide a healthtrackercapability instance to get a supported health tracker type list constructor detail healthtrackingservice public healthtrackingservice connectionlistener connectionlistener, context context constructor of healthtrackingservice parameters connectionlistener - the instance of connectionlistener for a connection state with samsung's health tracking service context - the client application context since 1 0 0 method detail connectservice public void connectservice establish connection with samsung's health tracking service since 1 0 0 gethealthtracker public healthtracker gethealthtracker healthtrackertype healthtrackertype provide a healthtracker instance for the given healthtrackertype parameters healthtrackertype - a healthtrackertype the available tracker types are healthtrackertype accelerometer_continuous healthtrackertype ecg_on_demand healthtrackertype heart_rate_continuous healthtrackertype skin_temperature_continuous healthtrackertype skin_temperature_on_demand healthtrackertype spo2_on_demand healthtrackertype eda_continuous returns the healthtracker instance to listen to a connection event for the given healthtrackertype throws illegalargumentexception - if the given healthtrackertype is not proper unsupportedoperationexception - if the given healthtrackertype is not supported on the watch device illegalstateexception - if the service connection is not available call connectservice since 1 0 0 remark for healthtrackertype bia_on_demand and healthtrackertype mf_bia_on_demand , you need to set the user profile use gethealthtracker healthtrackertype, trackeruserprofile for healthtrackertype sweat_loss, you need to set the user profile and the exercise type use gethealthtracker healthtrackertype, trackeruserprofile, exercisetype for healthtrackertype ppg_continuous and healthtrackertype ppg_on_demand, you need to set the ppg types use gethealthtracker healthtrackertype, set <ppgtype> gethealthtracker public healthtracker gethealthtracker healthtrackertype healthtrackertype, trackeruserprofile userprofile provide a healthtracker instance for the given healthtrackertype and userprofile for healthtrackertype bia_on_demand and healthtrackertype mf_bia_on_demand, use this method parameters healthtrackertype - a health tracker type the available tracker types are healthtrackertype bia_on_demand healthtrackertype mf_bia_on_demand userprofile - trackeruserprofile info returns the healthtracker instance to listen to a connection event for the given healthtrackertype throws illegalargumentexception - if the given healthtrackertype or userprofile is not proper unsupportedoperationexception - if the given healthtrackertype is not supported on the watch device illegalstateexception - if the service connection is not available call connectservice since 1 0 0 gethealthtracker public healthtracker gethealthtracker healthtrackertype healthtrackertype, trackeruserprofile userprofile, exercisetype type provide a healthtracker instance for the given healthtrackertype, userprofile and type for healthtrackertype sweat_loss, use this method parameters healthtrackertype - a health tracker type available tracker types are healthtrackertype sweat_loss userprofile - trackeruserprofile info type - an exercise type to get a sweat loss value returns the healthtracker instance to listen to a connection event for the given healthtrackertype throws illegalargumentexception - if the given healthtrackertype is not healthtrackertype sweat_loss illegalargumentexception - if the given userprofile or type is not proper unsupportedoperationexception - if the given healthtrackertype is not supported on the watch device illegalstateexception - if the service connection is not available call connectservice since 1 0 0 gethealthtracker public healthtracker gethealthtracker healthtrackertype healthtrackertype, set<ppgtype> ppgtypeset provide a healthtracker instance for the given healthtrackertype, and ppgtypeset for healthtrackertype ppg_continuous and healthtrackertype ppg_on_demand, use this method parameters healthtrackertype - a health tracker type the available tracker types are healthtrackertype ppg_continuous healthtrackertype ppg_on_demand ppgtypeset - a set of photoplethysmogram ppg types returns the healthtrackertype instance to listen to a connection event for the given healthtrackertype throws illegalargumentexception - if the given healthtrackertype or ppgtypeset is not proper unsupportedoperationexception - if the given healthtrackertype is not supported on the watch device illegalstateexception - if the service connection is not available call connectservice since 1 3 0 gettrackingcapability public healthtrackercapability gettrackingcapability provide a healthtrackercapability instance to get a supported health tracker type list returns the instance of healthtrackercapability healthtrackingservice healthtrackingservice = new healthtrackingservice connectionlistener, context ; healthtrackercapability healthtrackercapability = healthtrackingservice gettrackingcapability ; since 1 0 0 disconnectservice public void disconnectservice release a connection for samsung's health tracking service since 1 0 0