Samsung Health Data is available on Android devices only!
To set up the Spike SDK create SpikeConnectionV3
instance with your Spike application id, application user id and signature unique to each of your apllication users (more on generating signatures here):
If you want to read data from Samsung Health, you have to ensure user gives your app permissions.
First, you have to check if Samsung Health is available on users phone using
checkSamsungHealthDataAvailability
method:
where
If Samsung Health is installed, you can ask user for permissions using requestPermissions
method:
Please note that users might only grant partial permissions. In such cases, it’s up to you to decide whether your app can function effectively with limited access. The SpikeSDK itself will still operate even without full permissions; however, it may result in no data being returned in certain scenarios.
You can now use StatisticsFilter(providers = listOf(Provider.SAMSUNG_HEALTH_DATA))
to specifically retrieve data from Samsung Health. Alternatively, you can omit the
providers parameter entirely and allow Spike to choose the most suitable data source based on your request.
Reading data is the same as for Android Health Connect. The only difference is that
you may want to filter results by Provider.SAMSUNG_HEALTH_DATA
to get only Samsung Health data:
Samsung Health data can be delivered in background the same way as Apple HealthKit or Android Health Connect. If you want to use background delivery to get Samsung Health data, you have to enable Samsung Health Data integration first:
After enabling Samsung Health Data integration, you can use background delivery normally. See Background Delivery section for more details.