I prepared Android app codes with Google Maps and clustering feature. Feel free to use these as basis for your new projects. They are on GitHub: [1] Default Map Markers: catzie/SimpleAndroidMapClustering [2] Custom Map Markers: catzie/Simple-Android-Map-Clustering-with-Custom-Markers I simply took the necessary classes and res files from Android Maps Utility demo, and then placed […]
Google Maps
Android Maps: Get current location coordinates with Google API Client Builder
To get your current location via Google Map in an Android app, this was how we do it:
1 2 3 4 |
@Override public void onMapReady(GoogleMap googleMap) { Location location = googleMap.getMyLocation(); } |
Stop. Don’t use that! The method GoogleMap.getMyLocation() is deprecated. Instead, we need to use FusedLocationApi and the callback onLocationChanged(). Here’s an example code that works for me ( consider copying the contents of onResume() into onStart() […]
Android Studio: add Google Map from empty activity (dev note)
//Update: I prepared a simple Android app that features a Google Map with markers that form clusters together when zoomed out. Check it out: Simple Android Map Clustering on GitHub. This “dev note” of mine will give you a rough idea on how to add a Google Map to your Android up from an empty […]
Google Maps get coordinates on click or drag and drop
With this tutorial you’ll see how we can place a Google map with search box on your web page, and then get coordinates (i.e. latitude and longitude) based on where you click or where you drag and drop the marker into. The JavaScript API of Google Maps will help us achieve this. This kind of […]