flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

No way of filtering out data is from apple watch, connected device or manually added from Apple Health App

Open ketanphpdots opened this issue 1 year ago • 2 comments

health plugin not provide any enum which will help us to differentiate date fetched is from apple watch, connected device or user have added manually.

Platform

  • iOS

Describe the bug

When we fetch data from Apple Health Kit using health plugin then we are getting data like given below

{value: {numericValue: 78.28833728004247}, data_type: DISTANCE_WALKING_RUNNING, unit: METER, date_from: 2023-07-10T19:53:02.257, date_to: 2023-07-10T19:57:24.170, platform_type: ios, device_id: 479CJ5E6-9A0B-46D5-8F4C-935B64C4RV40, source_id: com.apple.health.E3D851C3-FAF2-4475-8724-9E74072B2ED9, source_name: user's Phone}

{value: {numericValue: 23.770267132669687}, data_type: DISTANCE_WALKING_RUNNING, unit: METER, date_from: 2023-07-10T19:51:42.242, date_to: 2023-07-10T19:52:25.713, platform_type: ios, device_id: 479CJ5E6-9A0B-46D5-8F4C-935B64C4RV40, source_id: com.apple.health.0E925BF3-9623-4B08-93D7-EB6C08E216CC, source_name: user’s Apple Watch}

{value: {numericValue: 1995.58656}, data_type: DISTANCE_WALKING_RUNNING, unit: METER, date_from: 2023-06-16T15:00:00.000, date_to: 2023-06-16T15:35:00.000, platform_type: ios, device_id: 479CJ5E6-9A0B-46D5-8F4C-935B64C4RV40, source_id: com.apple.Health, source_name: Health}

Here, source_name can be modified by user. So, How can we identify that which data belongs to which type (Here type refers to Apple Watch, Connected Device, Manually added by user.

If we try to filter this data based on keyword like "watch" then user may change his device name and include a word "watch" so which will not help us.

Expected behavior

{value: {numericValue: 78.28833728004247}, data_type: DISTANCE_WALKING_RUNNING, unit: METER, date_from: 2023-07-10T19:53:02.257, date_to: 2023-07-10T19:57:24.170, platform_type: ios, device_id: 479CJ5E6-9A0B-46D5-8F4C-935B64C4RV40, source_id: com.apple.health.E3D851C3-FAF2-4475-8724-9E74072B2ED9, source_name: user's Phone, source_type: apple_phone}

{value: {numericValue: 23.770267132669687}, data_type: DISTANCE_WALKING_RUNNING, unit: METER, date_from: 2023-07-10T19:51:42.242, date_to: 2023-07-10T19:52:25.713, platform_type: ios, device_id: 479CJ5E6-9A0B-46D5-8F4C-935B64C4RV40, source_id: com.apple.health.0E925BF3-9623-4B08-93D7-EB6C08E216CC, source_name: user’s Apple Watch, source_type: apple_watch}

{value: {numericValue: 1995.58656}, data_type: DISTANCE_WALKING_RUNNING, unit: METER, date_from: 2023-06-16T15:00:00.000, date_to: 2023-06-16T15:35:00.000, platform_type: ios, device_id: 479CJ5E6-9A0B-46D5-8F4C-935B64C4RV40, source_id: com.apple.Health, source_name: Health, source_type: apple_health_sdk}

should have a constant like source_type: apple_phone, apple_watch, apple_health_sdk

ketanphpdots avatar Jul 11 '23 08:07 ketanphpdots