We’re always looking for ways to improve your Google Maps Platform development experience on Android, so we’ve been working on an updated renderer for the Maps SDK for Android to give you access to more features and better performance.
Thanks to those developers who opted in to use our updated renderer back in October 2021. Your feedback on what worked well and what needed improvement was implemented in the latest version ready for you to try out now. The upgraded map renderer is available as of version 18.0.0 of the Maps SDK for Android. We encourage you to opt-in to use it and let us know how it’s working.
From our partners:
Benefits of the new map renderer include:
- Reduced network load, processing demand, and memory consumption
- Faster cold starts than the previous renderer
- A more stable and improved user experience
- Improved gesture handling for better animations, plus smoother panning and zooming
- More fluid transitions and clearly positioned map labels
- Cloud-based maps styling feature
- Advanced polyline customizations
Devices that can use the new renderer:
- Android 5.0 (API level 21) or later
- 2 GB or more of data storage
- Using Google Play services version 21.39.14 or later
Devices using Android 4.4W (API level 20) and earlier; with less than 2 GB of data storage; or using Google Play services versions 21.39.13 or older, will continue to use the legacy renderer.
How to upgrade to the new map renderer
- Update your app dependencies to use com.google.android.gms:play-services-maps:18.0.0 or higher.
- Update your code to explicitly import MapsInitializer, and MapsInitializer.Renderer.
- Update your code to call MapsInitializer.initialize(), to request Renderer.LATEST.
- Use OnMapsSdkInitializedCallback to determine which version of the renderer was returned.
Your code must call MapsInitializer.initialize() before any MapView, MapFragment, or SupportMapFragment has been created. We recommend calling this in onCreate for your app’s Application, or Activity, before its content view is set.
Examples
Here are two code samples for how to call MapsInitializer.initialize() to request a renderer version.
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.MapsInitializer.Renderer;
import com.google.android.gms.maps.OnMapsSdkInitializedCallback;
class MapRendererOptInApplication extends Application implements OnMapsSdkInitializedCallback {
@Override
public void onCreate() {
super.onCreate();
MapsInitializer.initialize(getApplicationContext(), Renderer.LATEST, this);
}
@Override
public void onMapsSdkInitialized(MapsInitializer.Renderer renderer) {
switch (renderer) {
case LATEST:
Log.d("MapsDemo", "The latest version of the renderer is used.");
break;
case LEGACY:
Log.d("MapsDemo", "The legacy version of the renderer is used.");
break;
}
}
}
Java code sample
import com.google.android.gms.maps.MapsInitializer
import com.google.android.gms.maps.MapsInitializer.Renderer
import com.google.android.gms.maps.OnMapsSdkInitializedCallback
internal class MapRendererOptInApplication : Application(), OnMapsSdkInitializedCallback {
override fun onCreate() {
super.onCreate()
MapsInitializer.initialize(applicationContext, Renderer.LATEST, this)
}
override fun onMapsSdkInitialized(renderer: MapsInitializer.Renderer) {
when (renderer) {
Renderer.LATEST -> Log.d("MapsDemo", "The latest version of the renderer is used.")
Renderer.LEGACY -> Log.d("MapsDemo", "The legacy version of the renderer is used.")
}
}
}
Kotlin code sample
We’re here to help
Not working right? Need help? Please let us know what’s going on by submitting an issue to our issue tracker, and we’ll help you out as soon as possible. Check out the docs for complete details on how to opt-in and start to use the new Maps renderer for Android. We look forward to hearing your feedback on how it works for you. Already upgraded to the new renderer? Please take a moment to fill in this short survey to help us make it even better! Thanks!
For more information on Google Maps Platform, visit our website: https://cloud.google.com/maps-platform/
By Ilya Bezdelev Product Manager, Google Maps Platform
Originally published at Google Cloud
Source: Cyberpogo
For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!
Our humans need coffee too! Your support is highly appreciated, thank you!