Android Location getTime() adding 1 day bug

1.5k views Asked by At

I'm currently using a Samsung Galaxy Tab P1000, and I'm stuck in a problem that I don't know for sure if happens in all smartphones. When synchronizing the GPS, everytime I get the location.getTime(); it returns the actual date plus 1 day. Am I doing something wrong or is this a bug?

Here is the code:

@Override
    public void onLocationChanged(Location location) {
        setRealTime(location.getTime()); 
        ...
        data = new Date();
        data.setTime(getRealTime());
    }

And then for example, it today is 15:31 01/16 it shows 15:31 01/17

The Problem is exclusively in the Samsung Galaxy Tab P1000...

any ideas?

1

There are 1 answers

0
Billy Charlton On BEST ANSWER

This is a leap year bug in Samsung firmware, confirmed by Samsung. See Android : Samsung Galaxy Tabs and Android 2.2 Devices Showing GPS date 1 Day Advance from 1st jan 2012

That answer shows some code which works around it; short version is to use an NmeaListener instead of a LocationListener. And it may fix itself on Feb 29th...