I have been trying to develop a direct messaging communication setup over BLE between my Android App and my connectIQ app (on Garmin Forerunner 230, SDK version 1.3.x). The goal here is that the Android app is collecting some data, and then pushing it to the watch app to display. For the moment, I am sending data (1 int value) every second.
Below is the code on my mailbox listener:
function initialize() {
AppBase.initialize();
Sys.println("app-initialize()");
mailMethod = method(:onMail);
Comm.setMailboxListener(mailMethod);
}
function onMail(mailIter) {
var mail = mailIter.next();
while(mail!=null) {
Sys.println("app-onMail: received - "+mail);
message = mail.toString();
Ui.requestUpdate();
mail = mailIter.next();
}
Comm.emptyMailbox();
}
Assuming the messages from Android are 1, 2, 3, 4, 5: I would like the app to do update the UI as the messages are read, like this:
app-onMail: received - 1
//update the UI
app-onMail: received - 2
//update the UI
app-onMail: received - 3
//update the UI
app-onMail: received - 4
//update the UI
app-onMail: received - 5
//update the UI
Instead, this happens
app-onMail: received - 1
app-onMail: received - 2
app-onMail: received - 3
app-onMail: received - 4
app-onMail: received - 5
//update the UI
//update the UI
//update the UI
//update the UI
//update the UI
How can I update the UI in real time as I receive message from the phone app?
Thanks in advance for your responses!