[CIQBUG] Communication does not work in SDK 1.0.0

In SDK 1.0.0, the method Communication.makeJsonRequest(...) does not work properly, whereas it does in SDK 0.24.0.

You can easily test the following code. Remember to grant communication permission.

using Toybox.Application as App;
using Toybox.WatchUi as UI;
using Toybox.Graphics as G;
using Toybox.Communications as Comm;
using Toybox.Timer;

class TestSwitchViewApp extends App.AppBase {
function onStart() {
}

function onStop() {
}

function getInitialView() {
return [ new View1() ];
}

}

class View1 extends UI.View {
var txt = "---";

function onLayout(dc) {
}

function onShow() {
Comm.makeJsonRequest("http://ip.jsontest.com/", {}, {}, method(:response));
}

function response(code, data) {
txt = code.toString();
UI.requestUpdate();
}

function onUpdate(dc) {
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_WHITE);
dc.clear();

dc.drawText(dc.getWidth()/2, dc.getHeight()/2, G.FONT_MEDIUM, txt, G.TEXT_JUSTIFY_CENTER|G.TEXT_JUSTIFY_VCENTER);
}

function onHide() {
}
}
  • More subtle than that, I fear. I have no experience of the prior SDKs but it seems that makeJsonRequest() "fails" on the simulator all of the time, and works much (some?) of the time on the real device. Well, on a Fenix 3 anyway. Do you find it failing on a different real device?

    Digging deeper, I see the simulator sending the request out on the wire, the response comes back as expected, but the response handler is never invoked on the simulator.

    Ironically, if you mess up the request, or you get a 404 for example, then the response handler is invoked.

    All in all, it's quite an exercise in frustration.
  • It does work in the simulator, it is just intermittent. The weather sample program works some of the time. I believe that this is a known issue, as it has been brought it up several times in the past...

    https://forums.garmin.com/showthread.php?158104
    https://forums.garmin.com/showthread.php?202884
  • I had started a thread about that earlier, too.

    I have made exatly the same frustrating way through.. First check the example, result: It works!
    Than i implemented my own code, got some 404 errors and thougt the webserver was broken...
    Later on i never got any callback, only if the bluetooth queue was full (after a few (5?!?) requests)...

    Let's hope for the next release to come in the next days!
  • It does work in the simulator, it is just intermittent. The weather sample program works some of the time.


    I can tell you it is consistently not working for me with MacOSX and SDK 1.0.0 :(
    With SDK 0.24.0 the example works... consistently...

    I believe that this is a known issue, as it has been brought it up several times in the past...

    https://forums.garmin.com/showthread.php?158104
    https://forums.garmin.com/showthread.php?202884


    The first issue seems to be with SDK 0.24.0 - which works, and the second issue seems to be with fenix3, not the simulator.
  • Former Member
    Former Member over 10 years ago
    makeJsonRequest does not work in SDK 1.0.0. There is a bug in the return queue that is preventing the response callback from being called. The queue will eventually fill and the API will return queue full errors.

    We have corrected this issue, and hope to have an updated SDK out soon.
  • makeJsonRequest does not work in SDK 1.0.0. There is a bug in the return queue that is preventing the response callback from being called. The queue will eventually fill and the API will return queue full errors.

    We have corrected this issue, and hope to have an updated SDK out soon.


    Thanks for the update.

    I have several different widgets that all require JSON so I'm looking forward to the new SDK - hopefully with 920XT firmware with full widget support :-)