HealthDataUtil
overviewpackageclasstreedeprecatedindex com samsung android sdk healthdata class healthdatautil java lang object com samsung android sdk healthdata healthdatautil public class healthdatautil extends object this class provides useful utilities healthdatautil makes compressed json conversion easy suppose livedata class that defines as the healthconstants exercise live_data's json format public class livedata { long start_time = 0l; float heart_rate = 0 f; float cadence = 0 f; float count = 0 f; float power = 0 f; float speed = 0 f; } make sure to add gson as a maven dependency to your project dependencies { implementation "com google code gson gson 2 7" } converting data to compressed json live_data can be retrieved as the example below public byte[] createlivedata list<livedata> livedatalist { // convert data class to json string byte[] zip = healthdatautil getjsonblob livedatalist ; return zip; } getting data from compressed json you can read detailed information of exercise data after decompressing them public list<livedata> getlivedata byte[] zip { // decompress zip list<livedata> livedatalist = healthdatautil getstructureddatalist zip, livedata class ; return livedatalist; } since 1 3 0 method summary all methods static methods concrete methods modifier and type method and description static <t> byte[] getjsonblob list<t> structureddatalist converts a given input list object to the raw data which is formatted with json and compressed static <t> byte[] getjsonblob t structureddata converts a given input object to the raw data which is formatted with json and compressed static <t> t getstructureddata byte[] jsonblob, class<t> clazz converts a given raw data to the particular class type static <t> list<t> getstructureddatalist byte[] jsonblob, class<t> clazz converts a given raw data to the list of particular class type method detail getjsonblob public static <t> byte[] getjsonblob t structureddata converts a given input object to the raw data which is formatted with json and compressed parameters structureddata - an object of a specified class returns compressed blob data with the json format throws illegalstateexception - if an untreatable error has occurred getjsonblob public static <t> byte[] getjsonblob list<t> structureddatalist converts a given input list object to the raw data which is formatted with json and compressed parameters structureddatalist - an object for which json blob is to be created returns compressed blob data with the json format throws illegalstateexception - if an untreatable error has occurred getstructureddata public static <t> t getstructureddata byte[] jsonblob, class<t> clazz converts a given raw data to the particular class type parameters jsonblob - compressed blob data which is formatted with json and compressed clazz - a class object of the destination instance returns a converted t type object from the compressed blob data throws illegalargumentexception - if json is invalid representation for an object type illegalstateexception - if an untreatable error has occurred getstructureddatalist public static <t> list<t> getstructureddatalist byte[] jsonblob, class<t> clazz converts a given raw data to the list of particular class type parameters jsonblob - compressed blob data which is formatted with json and compressed clazz - a class object of the destination instance returns an converted t type object from the compressed blob data throws illegalargumentexception - if json is invalid representation for an object type illegalstateexception - if an untreatable error has occurred