To do this, I call Communications.makeWebRequest from my app every time my position updates.
During my trial runs I ran into two problems:
1. One second is not enough time for the request to be made in some circumstances, so I encountered error -101 BLE_QUEUE_FULL several times. To get around this I drop requests if the queue is full, but it is not ideal as having real-time data is critical to my scenario.
2. On my first long test, about 40 minutes into streaming, we started getting the error -2 BLE_HOST_TIMEOUT somewhat sporadically from the makeWebRequest call. At that time the refresh rate on the web app went down significantly from 15 - 20 updates per minute down to 1 - 3. I couldn't find any information on how I could get around this error, as I suspect it's host-specific.
I suspect this architecture is not right, but I'm unsure of alternatives or if Garmin Connect IQ could support this. My code currently looks like this:
var data = {
"instantaneousSplit" => number,
"averageSplit" => number,
"metersTraveled" => number,
"timestamp" => Time.now().value().toNumber(),
"lat" => float,
"lng" => float
};
makeWebRequest(
"xxx.firebaseio.com/" + PATH,
data,
{
:method => HTTP_REQUEST_METHOD_PUT,
:headers => {
"Content-Type" => REQUEST_CONTENT_TYPE_JSON
},
:responseType => HTTP_RESPONSE_CONTENT_TYPE_JSON
},
callback);
I have not tried optimizing the packet size, but this does not seem like a significant amount of data to me.
Do you have any suggestions for how to make this scenario real?
Thanks
David