android google map v2 --- tilt reset to zero after clicking compass... - android

I have try the google map v2 example, the "Camera". I know the code below set the tilt to 50 to enable the 3D tilt feature.
static final CameraPosition BONDI =
new CameraPosition.Builder().target(new LatLng(-33.891614, 151.276417))
.zoom(15.5f)
.bearing(300)
.**tilt(50)**
.build();
But after clicking the google map compass, the "tilt" seems to be set to zero, now the 3D feature disappeared and just like a original 2d map.
My problem is how to reset the "tilt" back. I know one way to do that is using "moveCamera()" and give it a CameraUpdate with a "tilt". But is there any other way ?
Thanks.

Drag two fingers down just as in the Google maps app.

Related

FusedLocationProvider API. Transition Between GPS Locations

I have been working on retrieving GPS locations using Google's FusedLocationProvider API for about a week now. I have successfully gotten close to retrieving accurate gps data.
Currently the marker jumps around the map, instead I want it to smoothly animate like Google Maps, Waze, etc. I have searched the entire internet looking for a solution and have not found anything.
You could use animateCamera() method to set focus to new latlng.
CameraPosition cameraPosition = new CameraPosition.Builder().target(
new LatLng(17.385044, 78.486671)).zoom(12).build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
This will result in smooth transition.
PS:Play with the zoom to make it more realistic.
You are looking for this

Load a custom google map to android

I'm new to android development.
I need to load a custom google-map someone made in google maps (a map with marks and information).
My question is how to load this map on a android app (and not just creating a new map and manually adding all the markers and information -- because than each time client wants to change something in the map he will need to change it in 2 places).
I know i can just make a webview but than i can't access the location and focus on users location -- is there any other way?
Thanks for the help!
You can take the location of your indicated region and add the markers manually if there isn't place to mark.
static final LatLng MELBOURNE = new LatLng(-37.813, 144.962);
Marker melbourne = mMap.addMarker(new MarkerOptions()
.position(MELBOURNE)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
https://developers.google.com/maps/documentation/android-api/marker

Trying to show StreetView in by using Google Maps Android API v2 in android but not able to get it working

I am trying since long time to show the StreetView of particular location in Android but unfortunately unable to succeed.
What i require is that if i provide a position(LAT,LONG) to the map it should show the streetview of that particular position.
Following is the working code that shows Map, 3D map, hybrid map, sattlatite view etc etc..
BUT not showing the STREETVIEW...
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.addMarker(new MarkerOptions().position(new LatLng(33.748832, -84.38751300000001)).title("Marker"));
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
mMap.setTrafficEnabled(true);
CameraPosition cameraPosition = new CameraPosition.Builder()
.zoom(17) // Sets the zoom
.target(new LatLng(33.748832, -84.38751300000001))
.bearing(90) // Sets the orientation of the camera to east
.tilt(30) // Sets the tilt of the camera to 30 degrees
.build(); // Creates a CameraPosition from the builder
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
I just need is some way to show the StreetView..
You can now use what are supported by play-service library.
https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment
https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaView
You cannot embed streetview in your own app using Google Maps Android API v2.
You can:
run StreetView through Intent
try using javascript API v3 with WebView
Edit: note, this is now available on iOS, so may be available on Android in the future.
Since Google Play services 4.4.+ Streetview API is available. Check here https://developers.google.com/maps/documentation/android/streetview
You should use an image view to show the image. That will show the image view of the desired place. And add further OnclickListener on the image for view 360 or zoom.

Android GoogleMap follow my location

All the basic stuff, I have a SupportMapFragment, everything works fine, I just need to know if there is a short way of making the map follow my position or do I have to move the camera every time the location changes?
Well first of all thanks for your time Naskov but this is not a mapView, it's a MapFragment. the code I am using right now (in case someone needs it) is this (onUpdateLocation)
if (mapFragment.theMap != null) {
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(getLocation().getLatitude(),
getLocation().getLongitude())).zoom(14.0f).build();
CameraUpdate cameraUpdate = CameraUpdateFactory
.newCameraPosition(cameraPosition);
mapFragment.theMap.moveCamera(cameraUpdate);
}
I was just wondering if there is some built in method for doing it, also because this doesnt go very smooth. If someone comes up with a better idea please post it
It's not exactly what you want, but you can use:
map.setMyLocationEnabled(true);
To add a button to your map at top right corner (Like in the native Google Maps application) that will allow the user change the camera position to his location when he wants.

Blue screen in Android Google Maps

I am getting a blue screen when I load my Google Maps on Android. I don't know what I am doing wrong, this is my code for getting the locations:
MapView mapView = (MapView) findViewById(R.id.mapDire);
Route route = directions(new GeoPoint((int)(2*1E6),(int)(34*1E6)),
new GeoPoint((int)(3*1E6),(int)(36*1E6)));
I think can be two things
Your coordinates are 0,0 and the map is opening in the ocean
Something wrong with your API Key
In the first case try zoom out a lot of times and try to see some continent.
In the second try to read the documentation or/and try this link
I hope this helps.
I have this problem in my application and see below code in onlocationchanged method and resolve it.
LatLng myCoordinates = new LatLng(location.getLatitude(), location.getLongitude());
mMap.moveCamera(CameraUpdateFactory.newLatLng(myCoordinates));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 17.0f));
marker.setPosition(myCoordinates);
Normally blue screen means your Google API key didn't work.
GoogleMaps - Actual Map not showing
If your map is not showing, only grids/blank screen showing, that's because your Map API key is missing or incorrect. Sign up for Google Android Map API.
Try this the link for more info.
There could 3 reasons as to why You see blue screens
Your Long/Lat Points to Water region - or Ocean region, Invariably there's nothing wrong just you Long/Lat Pointing to Water which is blue in color.
Your Long/Lat is wrong and nothing comes up
Your API key is wrong which can be corrected on your Android manifest file
directory: Android/app/src/main/AndroidManifest.xml

Categories

Resources