i want to draw path on google map.
Basically what i am tracking user locaion after specfic time interval. when user reach to some destination then i need to draw the
I'm agree with antonio's answer. Problem is not with you drawing function. You just drawing path whatever device giving you location. Problem is your device is not giving accurate location.
Let me giving you brief description about Location Functionality.
There are three kind of provider giving location in device.
This provider determines location using satellites. Depending on conditions, this provider may take a while to return a location fix. Requires the permission ACCESS_FINE_LOCATION.
The extras Bundle for the GPS location provider can contain the following key/value pairs:
satellites - the number of satellites used to derive the fix
This provider determines location based on availability of cell tower and WiFi access points. Results are retrieved by means of a network lookup.
This provider can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself. This provider will return locations generated by other providers. You can query the getProvider() method to determine the origin of the location update. Requires the permission ACCESS_FINE_LOCATION, although if the GPS is not enabled this provider might only return coarse fixes.
Reference:
Android Location Manager
Android Location Providers - GPS or Network Provider?
As per my experience I can say
GPS Provideris giving you accurate location compare toNetwork Providerbut need open environment,GPS provideris not giving accurate location in inside building.
Returns a constant describing horizontal accuracy of this provider. If the provider returns finer grain or exact location, ACCURACY_FINE is returned, otherwise if the location is only approximate then ACCURACY_COARSE is returned.
This method will return exact value when location is changed from GPS Provider otherwise it will return approximate or 0 value.
Ref : Location.getAccuracy()
Solution:
Use only GPS Provider
Find out your location is accurate or not.
Recommended Use Google Client Sample Example.