geo fix in emulator - strange pattern in gps fix timestamps

by f...@zcom.it » Fri, 23 Apr 2010 08:03:50 GMT


Sponsored Links
 Hi,

The problem is that location.getTime() returns UTC timestamp.
You have to convert it in a GMT timestamp.

If you already solved the problem could you please post the solution.
thx

regards Fabi




--



Other Threads

1. GPS code works in HTC machines but fails in MOTO's



Excellent advice!

(though, a nit: in your first bullet, perhaps you mean onCreate() for
the activity, since there is no onCreate() for View)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in US: 14-18 June 2010: http://bignerdranch.com

-- 

2. GPS code works in HTC machines but fails in MOTO's

My code to obtain GPS coordinate works perfect in HTC cells. But I
find it doesn't work in Moto Droid. I debug it and find eveything
seems fine. But the coordinate never obtained. Please read my code
first:

/////////// defining listener
        LocationListener locationListener = new LocationListener() {

                @Override
                public void onStatusChanged(String provider, int status, Bundle
extras) {
                }

                @Override
                public void onProviderEnabled(String provider) {}

                @Override
                public void onProviderDisabled(String provider) {}

                @Override
                public void onLocationChanged(Location location) {
                        stateGPS = PR.Types.SERVICE_ACTION_STATE_UPDATED;
                        currentPosition.latitude = location.getLatitude();
                        currentPosition.longitude = location.getLongitude();

                        locationManager.removeUpdates(locationListener);
                }
        };

.....
//////////updating location information
boolean gpsEnabled = false;
                if 
(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
{
                        new Handler(getMainLooper()).post(new Runnable() {

                                public void run() {
        
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0, 0, locationListener);
                                }
                        });

                        gpsEnabled = true;
                }

                if
(locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
{
                        new Handler(getMainLooper()).post(new Runnable() {

                                public void run() {
        
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
0, 0, locationListener);
                                }
                        });

                        gpsEnabled = true;
                }
.....
//////////////fetching coordinate
Location l = null;
                                if
(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                                        l =
locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                                }

                                if (l == null &&
locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
                                        l =
locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
                                }

                                locationManager.removeUpdates(locationListener);

                                if (l == null) {
                                        //gps unknown
                                        stateGPS = 
PR.Types.SERVICE_ACTION_STATE_OTHER;
                                        return;
                                } else {
                                        currentPosition.latitude = 
l.getLatitude();
                                        currentPosition.longitude = 
l.getLongitude();
                                        stateGPS = 
PR.Types.SERVICE_ACTION_STATE_UPDATED;
                                }
....

No error message, No fatal return. Every things invoked well, but
onLocationChanged() never be run, getLastKnownLocation() always return
null ----- No GPS information get at all. I check all the settings.
GPS device is opened and every thing is OK. The same code works in my
HTC magic, G2.

Please help me. Thank you!

-- 

3. Case Mate Google Nexus One Toug

4. Question on modifying application framework + importing to the Windows SDK

5. Intent action for network events in android sdk

6. gut morning

7. MapView, can't focus, unfocus, refocus an overlayitem