Jon
Jon

Reputation: 794

GPS stays on using Intent call

I have a quick behavior question. When I call the following lines of code:

String currURL = "http://maps.google.com/maps?saddr="+nLocation.getLatitude()+","+nLocation.getLongitude()+"&daddr=110+Possum+Hollow+Road,+Newark,+DE+19711+(Tri-State+Bird+Rescue)&hl=en&ll=AnotherLat,AnotherLong&spn=0.28323,0.683212&sll=AnotherLat,AnotherLong&sspn=0.283147,0.683212&geocode=FcejYQIdRnCE-w%3BFXn_XQIda4F8-yF_tbhhHBmAIw&vpsrc=0&mra=pd&z=11";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(currURL));
App.this.getParent().startActivity(browserIntent);

It seems to keep the GPS on. Is there something wrong in what I was doing?

Thanks! Jon

Upvotes: 0

Views: 228

Answers (2)

Mr-IDE
Mr-IDE

Reputation: 7641

If you are using an embedded MapView with a MyLocationOverlay, you need to explicitly clean up/disable this resource using MyLocationOverlay.disableMyLocation(), when your MapView closes. Because these individual overlays request for a location for themselves, and this can leave the GPS unit switched on, with the GPS icon flashing in the Status Bar.

Source: https://groups.google.com/d/msg/android-developers/SmiBz--6COc/blu9Bhkrt1QJ

Upvotes: 1

Reed
Reed

Reputation: 14974

If you requested location updates, then you must do removeUpdates(locationListener) So, right before doing startActivity, you might want to removeUpdates

Upvotes: 1

Related Questions