Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android google maps animate the camera slowly to my location

I need to move the camera to my location slowly in android, i use the code below but the camera change from position to another like switching between pages. this is my code

                 CameraPosition cameraPosition = new CameraPosition.Builder()
                            .target(location1)
                            .zoom(16)
                            .bearing(90)
                            .tilt(30)
                            .build();
                    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 10000, null);

                    CameraUpdate center=
                            CameraUpdateFactory.newLatLng(location1);
                 //   CameraUpdate zoomcam=CameraUpdateFactory.zoomTo(zoom);

                    googleMap.moveCamera(center);
like image 858
Malo Avatar asked Jan 09 '17 14:01

Malo


People also ask

How do you animate a camera on Google Maps?

To apply a CameraUpdate to the map, you can either move the camera instantly or animate the camera smoothly. To move the camera instantly with the given CameraUpdate , you can call GoogleMap. moveCamera(CameraUpdate) . The CameraUpdate describing where to move the camera.

How do I calibrate Live View on Google Maps?

To calibrate with Live View, you will need to point your phone cameras at buildings and signs across the street. The new 'Calibrate with Live View' option is now available on ARCore-compatible Android smartphones running the latest version of Google Maps.

What is camera position in Google Map?

An immutable class that aggregates all camera position parameters such as location, zoom level, tilt angle, and bearing. Use CameraPosition. Builder to construct a CameraPosition instance, which you can then use in conjunction with CameraUpdateFactory .

Can Google maps see live?

Google Maps offers two views for walking navigation: the 2D map and Live View. With Live View, you get directions placed in the real world and on a mini map at the bottom of your screen. You can use Live View navigation during the walking portion of any type of trip.


1 Answers

Just remove googleMap.moveCamera(center);. Use only googleMap.animateCamera(center);.

like image 135
Shubham Jain Avatar answered Oct 14 '22 06:10

Shubham Jain