Logging issues - Meta motion R

I have been trying to create an app which tracks the steps using the Meta motion R trackers. They are using the latest firmware and I'm using API v3.0.17(Latest).  Although I'm having trouble downloading the data, my code is as below. I am using React native to invoke each one of these methods.



public void setupSensor(){
accBmi160.stepDetector().configure().mode(AccelerometerBmi160.StepDetectorMode.ROBUST);

accBmi160.stepDetector().addRouteAsync(new RouteBuilder() {
@Override
public void configure(RouteComponent source) {
source.log(new Subscriber() {
@Override
public void apply(Data data, Object... env) {
System.out.println("Step taken"+data.toString());
steps+=1;
}
});
}
});
}

@ReactMethod
public void startLogging(){
logging.start(true);
accBmi160.stepDetector().start();
accBmi160.start();
}

@ReactMethod
public void ReadSteps(){

logging.downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
@Override
public void receivedUpdate(long nEntriesLeft, long totalEntries) {
System.out.println("Progress Update = " + nEntriesLeft + "/" + totalEntries);
}
}).continueWithTask(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(Task<Void> task) throws Exception {
map = new Arguments().createMap();
System.out.println("Download completed "+steps);
map.putString("stepTook", Integer.toString(steps));
sendEvent("step", map);
return null;
}
});
}

Comments

This discussion has been closed.