Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Location getTime() adding 1 day bug

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?

like image 604
Andre Mariano Avatar asked Oct 09 '22 23:10

Andre Mariano


1 Answers

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...

like image 127
Billy Charlton Avatar answered Oct 13 '22 11:10

Billy Charlton