The Maps SDK supports variants of a style, with variants allowing for a different look and feel to be applied to the map based on context. In the SDK style variants can be assigned to different style modes, defined by the StyleMode enum. The Map Display module comes with two pre-defined styles, StyleMode.MAIN
and StyleMode.DARK
, which are used to show a bright daytime style and a darker nighttime style respectively.
In this example the device's light sensor is used to set the map's style mode to StyleMode.DARK
when the ambient light falls below 50 lux.
When running the example in the emulator the light sensor value can be set using the extended controls.
-
To run the example you'll need an API key with the Map Display API enabled.
-
Open the project in Android Studio, the file
local.properties
will be generated in your project level directory, and add the following code to local.properties, replacingYOUR_API_KEY
with your API key.
API_KEY=YOUR_API_KEY
- Save the file and run the app.