Reputation: 31
How to display current location with out using onLocationChanged method
Upvotes: 0
Views: 539
Reputation: 7521
Use requestLocationUpdates() and when you reach onLocationChange, stop it. That what my program does, this way you ensure that once the new location is gotten it will stop looking for updates.
Upvotes: 0
Reputation: 87440
You could use LocationManager.getLastKnownLocation()
, but that will only give you the last known location - which might be nothing (if the user just turned the phone on), or someplace hundreds of miles away (if the last time they turned a location service on was far away).
If you really want to know where the user is right now, you're going to have to implement a LocationListener.
Upvotes: 4