Hi there,
I am trying to update a widget that I wrote a while ago so that it can be used with the newer devices. I am having a lot of fun with the latest SDK 2.1.2 and testing the widget on my VivoActive.
My current issue is that I seem to be getting one view update behaviour in the simulator (it works) and different behaviour on the watch. The watch is using v1.3 and I have updated the manifest to allow back to CiQ v1.2.
The way the app works is it makes a call to an API that provides JSON data that I then want to display. Whilst the data is loading the Graph View is displayed saying Loading... The when the data is received I do stuff with it and then try to display it, partly by updating labels in my layout and partly by drawing some shapes. It looks like I get the app crash somewhere in the
function onUpdate(dc)
The way it is structured is:
Set some variables as the Layout drawables using View.findDrawableById
If no data is returned set the labels as blank and the status error as "Loading..." or the website error code
If data is returned manipulate the data to and set some of the labels as the data
Call
View.onUpdate(dc);
Then draw my graph using the draw functions
The error in the CIQ_LOG is:
ERROR: Circular Dependency Error
DETAILS: Unfreed memory on exit
STORE_ID: 00000000000000000000000000000000
CALLSTACK:
What results is a screen that shows a status before any data is loaded and then a graph with some additional data displayed once the onReceive callback happens.
The trouble is when I run it on the simulator it works but on the watch it sometimes works and sometimes does not. I set a counter to test this and it seems to relate to how long the data takes to load, if it is a long time I get this nasty circular reference crash with no decent information in the log. If it loads quickly it works better.
I am pretty sure that it is to do with calling View.onUpdate(dc);
because I can get remove it from the code and my widget half works, it just doesn't update the labels in my layout.
Also if I don't call it in the onUpdate function I get the menu I tem I left still displayed and the battery indicator (which isn't anywhere in my app) and it never updates on the watch. If I remove it in the simulator it just displays the shapes that I draw when data is returned.
So what am I doing wrong? And why did it used to work with older version of the SDK?
Thanks,
R.