Search code examples
androiddatetimestampdelay

May the conversion to Unix time to date fail on some Samsung Android devices?


I am currently doing a transportation app that displays the departure/arrival time of some trains in my country.

That is done via a webservice that gives me a JSON result that I format into HH:mm:

long attributeTime = departureArray.getJSONObject(i).getLong("time") * 1000;
Date time = new Date(attributeTime);
trains.add(new Train(hourFormatter.format(time),...)

This work pretty well on all my devices (Nexus S, HTC Desire, Acer STream, etc..) but I get some feedback from Samsung users that complain that my app gives one hour delayed results.

As the Market does not allow me to contact them, so I cannot ask them for more information. Their devices seem to be 2*Galaxy S and 1 * Ace, so the issue seem related to Samsung.

Have other people already had this issue with Samsung phones? Is there any workaround for that?


Solution

  • A delay of 1 hour likely has to do with timezone in some capacity. This could have to do with some bug in Samsung's software that incorrectly applies time zone information or it could be due to user location. If your code works on the other devices the problem is likely hardware/location/user/settings specific and I would venture a guess that it's going to be impossible to remedy this problem without access to the affected devices or at least a log file.

    If you really wanted to dig into this, I would suggest releasing an update to the app that allows users to submit a log file to you which you could then analyze to determine the problem. However, that isn't exactly a trivial solution.