How to make places in Google Maps to be objects like maps.google.com with Google Maps API in Android?
Tag : android , By : Angel Paunchev
Date : March 29 2020, 07:55 AM
this will help You are welcome to use an Overlay, or override onTouchEvent() in a custom subclass of MapView, to find out when the user taps the screen. You are welcome to use a Projection to determine the latitude and longitude of where the user tapped. You are welcome to pass that data to some Web service that can tell you what is at that location. And you are welcome to display those results in some form (e.g., Toast). However, none of that is built into the Google Maps SDK add-on for Android.
|
Android studio v0.3.2, gradle, google maps v2.0 Didn't find class "com.google.android.gms.maps.MapFragment
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I have problem with Google Maps Android v2.0. Because i try a lot of options and I always get this stacktrace: , You can resolve this problem when you change dependencies to: dependencies {
// compile 'com.google.android.gms:play-services:3.1.36'
compile 'com.google.android.gms:play-services:3.2.25' //3.2.25
compile 'com.android.support:support-v4:19.0.+'
compile 'com.android.support:appcompat-v7:19.0.+'
}
sudo . gradlew clean
sudo . gradlew build
sudo . gradlew installDebug
|
Google Play Services on Android Emulator 4.2.2 or higher. "Google Maps API demos won't run unless you update Google
Date : March 29 2020, 07:55 AM
should help you out Make sure you are using the Google APIs (Google Inc.) as your Emulator's target. and if this doesn't solve the problem, you can google the newest Google Play Services' apk and install it over adb install. =-=-= edit =-=-=
|
com.google.android.gms.maps.GoogleMap.addMarker(com.google.android.gms.maps.model.MarkerOptions)' on a null object refer
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I think you get onConnected callback starts before onMapReady Try to call mGoogleApiClient.connect() inside your onMapReady callback, to be sure map is not null. public class Map extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
GoogleMap map;
GoogleApiClient mGoogleApiClient;
Location mLastLocation;
Marker myLocatMarker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
buildGoogleApiClient();
mapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
mGoogleApiClient.connect();
}
});
}
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
System.out.println("ABC buildGoogleApiClient map was invoked: ");
}
@Override
public void onConnected(Bundle arg0) {
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if (mLastLocation != null) {
double lng = mLastLocation.getLongitude();
double lat = mLastLocation.getLatitude();
if (myLocatMarker != null) {
myLocatMarker.remove();
}
LatLng ll = new LatLng(lat, lng);
MarkerOptions markerOpt = new MarkerOptions().title("my location")
.position(ll)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.myloc));
System.out.println("ABC onConnected map: " + lat + " ; " + lng);
myLocatMarker = map.addMarker(markerOpt);
}
}
}
|
Package com.google.maps.android.geojson does not exist in com.google.maps.android:android-maps-utils:0.5+
Date : March 29 2020, 07:55 AM
I wish this helpful for you The geojson Class moved in to package com.google.maps.android.*data*.geojson. Changing the import to: import com.google.maps.android.data.geojson.*
|