You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a requirement to add sleep data to healthkit from Ionic App. I have been using 'saveQuantitySample' available in documentation. I tried below code shared, the healthkit plugin shows us that 'Quantity type string was invalid'. I even tried to pass quantity parameter too but same results. Is saving HKCategoryTypeIdentifierSleepAnalysis supported by plugin?
If we pass 'HKCategoryTypeIdentifierSleepAnalysis' in querySampleType method available in documentation, It is returning us correct values but not allowing us to save the same Type.
window['plugins'].healthkit.saveQuantitySample(
{
'startDate': new Date(new Date().getTime() - 24 * 60 * 60 * 1000), // a day ago
'endDate': new Date(), // now
'sampleType': 'HKCategoryTypeIdentifierSleepAnalysis',
'unit': '',
'amount' : 1, //Considering 0 for Asleep and 1 for In Bed.
},
function (value) {
alert("Success running saveQuantitySample, result: " + value);
},
function (error) {
alert("error running saveQuantitySample, result: " + error);
},
);
The text was updated successfully, but these errors were encountered:
I have a requirement to add sleep data to healthkit from Ionic App. I have been using 'saveQuantitySample' available in documentation. I tried below code shared, the healthkit plugin shows us that 'Quantity type string was invalid'. I even tried to pass quantity parameter too but same results. Is saving HKCategoryTypeIdentifierSleepAnalysis supported by plugin?
If we pass 'HKCategoryTypeIdentifierSleepAnalysis' in querySampleType method available in documentation, It is returning us correct values but not allowing us to save the same Type.
The text was updated successfully, but these errors were encountered: