Thanks for the replies guys, it's a really weird bug. It should be
simple! I think creating a service to handle the GPS is a good idea,
I'll try that

On Nov 4, 12:21 pm, loweroctave <twinte...@gmail.com> wrote:
> I was having a good deal of problems with the location listener
> starting / not starting / restarting when I didn't want it too
> (especially on Captivate phones) and it was further exacerbated by
> having multiple activities in my application.  I ended up creating an
> android service to control the GPS portion of things.  When you bind
> to the service you can get all the GPS data you need from it.
>
> You may want to try this method.
>
> On Nov 3, 5:03 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Strange...
> > When starting/stopping in onResume/onPause, it works well for me.
> > Do you have, by chance any other location listeners registered?
> > Try to make a bare-bones app with only one activity that just
> > registers and unregisteres a location listener. See if that works.
>
> > On Nov 3, 2:25 pm, Chirag Patel <chi...@gmail.com> wrote:
>
> > > Thanks for the response but it didn't help. Calling
> > > locationManager.removeUpdates(this);  causes the GPS icon to stop
> > > flashing so it does have some affect but it doesn't remove/stop it
> > > completely. When I put the application in the background and I leave
> > > it, I can see it's using up the cpu and battery due to the GPS being
> > > active. There are no other threads running in the app. This is very
> > > frustrating! Another problem which might be somehow related is that
> > > calling finish() on my Activity doesn't close it. If intercept the
> > > back button and call finish() the app goes into the background but the
> > > activity remains alive i.e when I go back to it, it doesn't start a
> > > new instance just resumes the old one. Any help on this would be much
> > > appreciated.. Thanks!
>
> > > On Nov 2, 10:45 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
> > > > Get the LocationManager in onCreate(). Store this in an instance-
> > > > variable.
> > > > Request location updates in onResume(), using the instance-variable.
> > > > Remove location updates in onPause(), using the instance-variable.
>
> > > > On Nov 2, 2:10 pm, Chirag Patel <chi...@gmail.com> wrote:
>
> > > > > Hi I'm having a problem when trying to stop location updates when the
> > > > > app goes into the background. In my onCreate() method I start request
> > > > > updates like this:
>
> > > > >                 LocationManager locationManager =
> > > > > (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
>
> > > > >                 
> > > > > locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
> > > > > LOCATION_UPDATE_INTERVAL, LOCATION_UPDATE_DISTANCE, this);
>
> > > > > locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
> > > > > LOCATION_UPDATE_INTERVAL, LOCATION_UPDATE_DISTANCE, this);
>
> > > > > Then in my onPause() and onDestroy() methods I request to stop the
> > > > > updates like this:
>
> > > > >                 LocationManager locationManager =
> > > > > (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
> > > > >                 locationManager.removeUpdates(this);
>
> > > > > However the GPS icon remains in the status bar and the only way to get
> > > > > rid of it is to manually kill the application. Am I doing anything
> > > > > wrong?
>
> > > > > Cheers- Hide quoted text -
>
> > > - Show quoted text -

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

Reply via email to