Offline position detection using macro

Hello,

So, I'm having difficulties using the macro class.
The following code runs fine when the metawear is connected to my android phone:

 macroModule.record(new Macro.CodeBlock() {
@Override
public void commands() {

accelModule.routeData().fromXAxis()
//.process(new Rss())
.process(new Average((byte) 8))
.process(new Threshold(0.9f, Threshold.OutputMode.BINARY))
.split()
.branch().process(new Comparison(Comparison.Operation.EQ, -1)).stream(NOUP_KEY)
.branch().process(new Comparison(Comparison.Operation.EQ, 1)).stream(UP_KEY)
.end()
.commit().onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
result.subscribe(UP_KEY, new RouteManager.MessageHandler() { //setLogMessageHandler(UP_KEY, new RouteManager.MessageHandler() {

@Override
public void process(Message message) {

//Log.i(LOG_TAG, "UP");
//ledModule.play(true);
hapticModule.startMotor((short) 500);
}
});

result.subscribe(NOUP_KEY, new RouteManager.MessageHandler() {//setLogMessageHandler(NOUP_KEY, new RouteManager.MessageHandler() {

@Override
public void process(Message message) {
//Log.i(LOG_TAG, "DOWN");
}
});
}
});
}
});


But the device stops responding when the connection is severed even though is it recorded in a macro.
How can I make sure this basic orientation sensor with haptic feedback remains functioning without Bluetooth connection.

The entire code can be found here: http://pastebin.com/WnwzjEVW
But is very messy, mostly because I don't have previous experiance with Java.


Comments

This discussion has been closed.