Ich versuche, eine Ti.Healthkit.StatisticsCollection zu erstellen, wo ich die Anzahl der Schritte abholen kann, gruppiert pro Tag. Die Sache ist, dass ich auch alle Quellen brauche, damit ich alle Schritte, die über Apple Health (manuell) und andere Quellen als das Gerät und die Apple Watch hinzugefügt wurden, "manuell" filtern kann.Titanium HealthKit Modul - Kann nicht StatisticsQuery mit Cumulative & Separate nach Quelle erstellen
Also; Ich habe die Statistik-Abfrage eingerichtet, alles sieht gut aus. Ich kann alle Quellen für jedes Datum abrufen. Aber, hier ist die Sache, ich kann nicht egal was, bekomme die Anzahl der Schritte, pro Quelle.
var query = HealthKit.createStatisticsCollectionQuery(
{
type : HealthKit.OBJECT_TYPE_STEP_COUNT,
filter : HealthKit.createFilterForSamples(
{
startDate : date_from,
endDate : date_to
}),
options : HealthKit.STATISTICS_OPTION_CUMULATIVE_SUM | HealthKit.STATISTICS_OPTION_SEPARATE_BY_SOURCE,
anchorDate : anchorDate,
interval : 3600*24, // 24 hours
onInitialResults : function(e)
{
if (e.errorCode !== undefined)
{
//Utils.showError(e);
}
else
{
for(var i in e.statisticsCollection.statistics)
{
var statistics = e.statisticsCollection.statistics[i];
console.log(statistics.sources[0]);
var quantity = statistics.getSumQuantityForSource(statistics.sources[0]);
var stepCount = quantity.valueForUnit(HealthKit.createUnit('count'));
console.log(statistics.sources);
//console.log(statistics.startDate);
console.log(stepCount);
for(var k in statistics.sources)
{
var _source = statistics.sources[k];
var quantity = statistics.getSumQuantity(_source);
console.log(_source);
console.log(quantity);
Ich habe versucht, den Apple-docs sowie die Ti.HealthKit docs zu folgen, und so weit ich habe ich jetzt alles versucht zu sehen. Ich habe auch versucht, die Schritte zu holen, während ich alle Quellen iteriere, um es innerhalb der Statistikmethode zu setzen;
sumQuantityForSource (_Source)
aber das gibt nur "null".
kann ich die Anzahl der Schritte für einen Tag, aber es enthält alle Schritte Quellen ..
Hat jemand einen Vorschlag, was zu versuchen? Ich habe das Gefühl, alles versucht zu haben.