Ashish Upadhyay
Ashish Upadhyay

Reputation: 21

Best way to implement user's location

I have read couple of articles about location updates and getting user's location on android, but still I am getting confused, when I am going to implement as per my requirement, considering all the facts of performance, battery consumes and accuracy. below is my requirement. I want to get the user's current location using GPS, if the GPS is not available then prompt to user regarding the same & provide the location based on Network location (ex, based on triangulation of cell towers or any other which gives the most accurate result ).

When ever user changes his location it should update the location & inform user.

I'll be very thank full if can any one suggest me some appropriate solution with some sample code.

Thanks Regards

Ashish

Upvotes: 2

Views: 558

Answers (2)

Anonsage
Anonsage

Reputation: 8320

Here is an excellent resource provided by developer.android.com. It talks about the different strategies to use when you want the user's location. Sample code is provided also.

http://developer.android.com/guide/topics/location/strategies.html

Upvotes: 0

GPSmaster
GPSmaster

Reputation: 914

You should check out some of these questions i asked. Nobody seemed to be able to help me so i eventually answered my own question. I have found that the most efficient method ( in terms of battery consumption) is to request a location update and stop the location update after a position fix is found. Then re-request an update after a period of time or when you see fit. How to time out GPS signal acquisition and Change minTime for GPS LocationListener dynamically

Upvotes: 1

Related Questions