简体   繁体   中英

Getting the previous camera Latitude and Longitude on Google Maps

Im currently working with google maps on my android app and i need to compare distances when the camera is moved. I can get the current camera latitude and longitude by using the onCameraChange method, however, im struggling with getting the cameras previous latitude and longitude. Any suggestions would be great.

I do not see an existing API to get previous location with Google Maps Camera position api

You can create a prevLat , and prevLong variables. The first time your app starts, in initialization, save the location in these variables. Use these to calculate the distance in onCameraChange , and then update the prevLat, prevLang with current location at the end of onCameraChange .

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