简体   繁体   中英

How to update latitude/longitude in Android on google maps?

I am developing an indoor location application where the latitude/longitude will be updated from gathered sensor data. I cannot find any API that assists with simply updating the latitude/longitude on a map as that is literally the only thing I want to do. I do not want to use GPS data as the intent of the application is for indoor locations where GPS signal is heavily challenged ie under ground parking. Did I maybe miss something in the google maps API that someone can point me too? I will be calculating the new latitude/longitude using old lat/lon data and the sensor data (accelerometer for example).

So long story short, I want to update the marker on the map using sensor data only and I cannot find a library function in the API that allows me to update latitude/longitude on the map. Is there anything that can do that based on the new latitude/longitude I calculate?

You should save a reference (1) of the marker that you first create, and then update (2) his location.

1) Marker marker = mMap.addMarker(new MarkerOptions().position(firstLatLng));

2) marker.setPosition(newLatLng);

Actually, if you want to know more about updating all map features take a glance at google map API

But, if you are running out of time and want a quick fix to your lattitude and longitude updates every time then have a look at this receiving location updates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM