makeJsonRequest - result not reaching watch.

Former Member
Former Member
I've got an app that makes a json request to a web service.

It works fine in the simulator, talks to the real web service, retrieves data and renders on the watch.

However, when I deploy this app onto my watch (Fenix3, latest stable firmware) it doesn't work.

Watching the logs on the web-service I can see that the json request gets to the server and that it returns the appropriate data back to the phone but for some reason the data doesn't go from the phone back to the watch.

Any ideas?
  • Couple of things.

    1) how big is the response? (number of bytes)

    2) how complex is the response? When converting the response to a dictionary, with complex data the watch may not have enough objects available. (there is a limit on both the memory and number of objects available to the app over all)

    3) how big is your app? Out of 64k, how close to that are you?


    Do you see anything in the (pre-created) ciq_log.txt on the watch?
  • Former Member
    Former Member over 9 years ago
    This is actually pushing a lot less data than some other apps I've been writing

    Request: http://104.130.0.230:5699/tides?lat=52.4140&lon=-4.0810

    Response: {"tidalSource": "tidesnear.me", "lat": 52.414, "tides": [{"date": "2016-01-30", "height": 1.3, "type": "Low", "datetime": "2016-01-30T05:57+0000"}, {"date": "2016-01-30", "height": 4.4, "type": "High", "datetime": "2016-01-30T11:33+0000"}, {"date": "2016-01-30", "height": 1.4, "type": "Low", "datetime": "2016-01-30T18:29+0000"}, {"date": "2016-01-30", "height": 4.1, "type": "High", "datetime": "2016-01-30T23:58+0000"}], "lon": -4.081, "location": "Aberystwyth"}

    App itself uses 24k before it receives data.

    Interested in your thoughts here.

    -Rob
  • Both size an complexity look fine to me.

    Here's something else - it could still be the # of objects your app uses outside of the call.

    For example, do you use any large multi-dimensional arrays?

    like:

    var ARRAYSIZE=100;
    var array=new[ARRAYSIZE];

    for(var i=0;i<ARRAYSIZE;i++) {
    array=new[2];
    }
    [/code]

    That will burn a bunch of objects.

    Instead, what I do is something like this:

    var array=new[ARRAYSIZE*2]
    var start1=0;
    var start2=ARRAYSIZE;

    It stays a one dimensional array (far cheaper object-wise), and then you use start1 and start2 to access the two parts:

    array[start1+i]=x;
    array[start2+i]=y;
  • Former Member
    Former Member over 9 years ago
    Hi Jim,

    I previously got stung by chewing through memory quickly - an older version of this system cached data over multiple days at multiple locations - it was... overreaching.

    This current iteration is actually using a couple of simple single direction arrays to track things, one for heights, one for times.

    It's easy enough to iterate through and while I could have made it a 2d array etc, I was trying to keep things nice and simple in a way that would play easily with the app properties methods.

    So I'm still at a loss here really.
  • Do you get any error code in the callback for the data? (on the real device), or do you just see nothing?
  • Former Member
    Former Member over 9 years ago
    ERROR: Unhandled Exception

    DETAILS: Failed invoking <symbol>

    STORE_ID: 00000000000000000000000000000000

    ^^ from CIQ_LOG.TXT

    It seems to me that the data is getting back to the watch but for some reason I'm triggering an exception that doesn't happen in the simulator... I'm trying to wrap up various things (that I think shouldn't throw exceptions) with some handlers to see what happens.

    Is there any way I can put an entry in the CIQ_LOG file ?

    -Rob
  • Former Member
    Former Member over 9 years ago
    Thank you for your help with this thread.

    The debugging info was extremely useful.

    Eventually I found a bug in my code, in a few places I wanted to convert from a 'moment' to a specific string representation - when I was doing this I was calling:

    Calendar.info(somevar);

    However, the correct invocation is:

    Calendar.info(somevar, format);

    Although I was calling it incorrectly it seemed to work fine in the simulator, though it blows up on the watch with a slightly confusing error. It's working now, nothing to do with the makeJsonRequest in the end, it just made it seem that way.

    Thanks
    -Rob