Getting my Android app to work with the github Android CloudSDK

After much pain and suffering I have succeeded in building Particles Android CloudSDK which can be found on GitHub and then fixing a bug in that SDK so that it can correctly parse the date fields that come from the server.

For anyone in need of the same fix here it is for you to copy:

In file I did the following:
// PVH_NOTE: Replaced this line with the lines below.
//this.gson = new Gson();
this.gson = new GsonBuilder()

This change prevents the gson from throwing an exception when it parses a date field that contains fractions of a second (as denoted by the .SSS). For whatever reason the json responses for my device contains this date format. I don’t know if that’s true for all devices (mine are pretty old) but it is at least true for mine. Since these messages are ultimately coming from Particle’s Server, I would expect the format to be the same regardless of the device, but perhaps there is some device dependency that I am not aware of. In any case. This one change allows me to get a working Android app on my phone that can interact with my devices.


Good job! Thanks for sharing the fix.