This same code works fine on a G1 (1.5/1.6), Magic, Droid, Cliq,
Samsung Behold and Moment.  I was previously using a 10 minute update
interval.

I think it was the firmware update Sprint/HTC applied recently.  While
it fixed many of the gigantic bugs with the Hero, it introduced this
one.

I confirmed it with this test code:


public class GPSBugActivity extends Activity implements
LocationListener
{
        private static final int MIN_TIME = 60000; // 1 minute
        private static final int MIN_DISTANCE = 1000; // 1 kilometer

        private LocationManager locationManager = null;

        @Override
        public void onCreate(Bundle savedInstanceState)
        {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);

                locationManager = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);
                
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
MIN_TIME, MIN_DISTANCE, this);
        }

        @Override
        protected void onDestroy()
        {
                super.onDestroy();

                locationManager.removeUpdates(this);
        }

        @Override
        public void onLocationChanged(Location arg0)
        {
        }

        @Override
        public void onProviderDisabled(String arg0)
        {
        }

        @Override
        public void onProviderEnabled(String arg0)
        {
        }

        @Override
        public void onStatusChanged(String arg0, int arg1, Bundle arg2)
        {
        }
}

The log had the fact that it was removing the listener...but it
doesn't seem to matter...

12-05 00:20:46.008: DEBUG/LocationManager(1941): removeUpdates:
listener = com.gpsbug.gpsbugactiv...@4348f94012-05 00:20:50.201: DEBUG/
LocationManagerService(70): CdmaPollingThread exiting

I'm still not sure if it's actually running the GPS or just flashing
the icon, but either way it looks bad to the end user.

-Alex


On Dec 5, 12:04 am, Mark Wyszomierski <[email protected]> wrote:
> Alex, have you tried a simple test of just registering, then
> deregistering the listeners in an otherwise empty project? On my
> G1/1.5, I don't get this behavior, the GPS icon goes away shortly
> after a deregister. If it's a quirk on that device, that is worrisome.
> In that case, many apps will burn out the user's battery?
>
> Mark
>
> On Dec 4, 11:57 pm, Alex <[email protected]> wrote:
>
>
>
> > I can confirm that an update interval of greater than 35 seconds
> > causes theGPSstatus icon to blink on an Sprint HTC Hero (Firmware
> > 1.56.651.2).  It does not ever go away, it will blink all day long.
> > You can run and exit Google Maps and it goes away.
>
> > So now I get to decide whether to have this "bug" or run my location
> > listeners at a much faster rate than I normally would.
>
> > From the docs for requestLocationUpdates:
> > Background services should be careful about setting a sufficiently
> > high minTime so that the device doesn't consume too much power by
> > keeping theGPSor wireless radios on all the time. In particular,
> > values under 60000ms are not recommended.
>
> > -Alex
>
> > On Dec 2, 7:54 pm, Ken H <[email protected]> wrote:
>
> > > 1 minute seems long to me too, 5-10 sec is a good generic interval if
> > > you just want it to turn off quicker. Also remember that theGPSneeds
> > > a time *and* distance update interval.
>
> > > But my question is this, have you sat down and watched to see if the
> > > little satellite dish disappears after a minute? My guess is it
> > > should. Also remember your app is usually just suspended when you
> > > first turn it off (so it can be booted up quicker). If android needs
> > > the memory it will kill it.
>
> > > Ken
>
> > > On Dec 2, 11:24 am, Mark Wyszomierski <[email protected]> wrote:
>
> > > > I've been working with the location providers lately, I haven't seen
> > > > this behavior. When I deregister my listeners, theGPSicon goes away,
> > > > I haven't seen it stick around.
>
> > > > Even one minute intervals forGPSseems like a lot for me - I'm
> > > > guessing users won't be able to move fast enough in one minute to make
> > > > any real difference in location. All depends on the app though.
>
> > > > On Nov 19, 6:33 pm, jtoolsdev <[email protected]> wrote:
>
> > > > > I'm looking to a solution using the MyLocationOverlay library where
> > > > > one can use runOnFirstFix which can launch the thread (which I already
> > > > > have) when the current location is found.  Once it is found I can shut
> > > > > down the location stuff as I only need it at the start of the program.
>
> > > > > On Nov 19, 3:20 pm, Nathan <[email protected]> wrote:
>
> > > > > > On Nov 19, 12:09 pm, jtoolsdev <[email protected]> wrote:
>
> > > > > > > The recommendation of
> > > > > > > the SDK is for setting up the location listener is to set time at
> > > > > > > 60000ms or 1 minute.  
>
> > > > > > Really? Does Google Maps follow that guideline?
>
> > > > > > > My tests show if you use that number when
> > > > > > > exiting the app it may not shutdownGPS.  
>
> > > > > > Sounds bad.I hope there is an answer for that.
>
> > > > > > Nathan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to