Hi,
I see this error message in adb log. The "sync accelerometer OK" means that hte first-round of syncing succeeded, but it is still trying. Thus, the error comes during the second round (syncing records [10000,19999])
09-04 02:07:48.244 9735 10825 D AWARE : Sync accelerometer OK
09-04 02:07:48.249 9735 10825 W System.err: org.json.JSONException: Index 10000 out of range [0..10000)
09-04 02:07:48.257 9735 10825 W System.err: at org.json.JSONArray.get(JSONArray.java:293)
09-04 02:07:48.257 9735 10825 W System.err: at org.json.JSONArray.getJSONObject(JSONArray.java:521)
09-04 02:07:48.257 9735 10825 W System.err: at com.aware.utils.WebserviceHelper.onHandleIntent(WebserviceHelper.java:348)
09-04 02:07:48.257 9735 10825 W System.err: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
09-04 02:07:48.257 9735 10825 W System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
09-04 02:07:48.257 9735 10825 W System.err: at android.os.Looper.loop(Looper.java:148)
09-04 02:07:48.257 9735 10825 W System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
It is trying to do the steps needed to delete the old values so that it can upload the rest. However, it fails on this line:
long last = rows.getJSONObject(rows.length()).getLong("timestamp");
The error message says it all:
org.json.JSONException: Index 10000 out of range [0..10000)
If I understand this right, it should be rows.length()-1
instead of rows.length()
, since indexes go from [0...9999].
The effect is that on my device, syncing is about one day behind, each 15 minutes it gets about 5000 new points and syncs 10000, and I guess due to circumstances it falls behind sometimes. If webservice frequency was lower, data would accumulate forever. Also data isn't being deleted. This behavior has been seen on two phones.
While fixing this, it would be nice for "always clean old data" to clean old data from all tables, not just high frequency ones (line 346), as I have mentioned before.
Also, at one point you mentioned something suggesting that the web upload API was improved, but I see the same large number of requests as before (for every table, for every upload attempt, /create_table and /latest every time regardless of what data their is). Looking back at that, maybe it just meant that you wouldn't /create_table and /latest or each 10000 row chunk. Should I expect any other behavior? And are there any more improvement expected?
Thank you,