Introducci贸n a la Integraci贸n Nativa en Android

1

Integra APIs Nativas en Android

2

Creaci贸n proyecto base

Google Maps SDK

3

C贸mo crear una API key para Google Maps en Google Cloud

4

Creaci贸n de marcadores en Google Maps con Jetpack Compose

5

C贸mo dibujar rutas en mapas usando polil铆neas en Jetpack Compose

6

C贸mo enfocar autom谩ticamente mapas usando Camera Update Factory

Quiz: Google Maps SDK

Servicios de Localizaci贸n

7

Uso de Flows en Kotlin para Controlar Intervalos de Tiempo y Emisi贸n de Datos

8

C贸mo simular ubicaci贸n en emuladores y dispositivos reales

9

Creaci贸n de Modelos y C谩lculos de Localizaci贸n con Clean Architecture

10

Implementaci贸n de Localizaci贸n en Android Usando Flows

11

Inyecci贸n de dependencia para seguimiento de localizaci贸n en Android

12

Uso de StateFlows para rastrear ubicaci贸n en aplicaciones Android

13

Location Tracker

14

Implementaci贸n de Location Tracker con Inyecci贸n de Dependencias

Quiz: Servicios de Localizaci贸n

Integraci贸n Maps con Localizaci贸n

15

Integraci贸n de mapas din谩micos con CameraPositionState en Android

16

Creaci贸n y uso de polil铆neas en mapas con datos reales

17

Creaci贸n de una pantalla de mapa con Intents y estados en Jetpack Compose

18

Creaci贸n de un ViewModel para Seguimiento de Localizaci贸n en Android

Quiz: Integraci贸n Maps con Localizaci贸n

Manejo de permisos

19

Gesti贸n de permisos en Android para localizaci贸n, c谩mara y notificaciones

20

C贸mo implementar di谩logos para solicitar permisos en Android

21

Manejo de permisos de localizaci贸n y notificaci贸n en Android

22

C贸mo gestionar permisos en Android con Jetpack Compose

Quiz: Manejo de permisos

Integraci贸n c谩mara

23

Integraci贸n de c谩mara en Android con Photo Handler y manejo de permisos

24

Convierte Bitmaps a ByteArrays en Android con Kotlin

25

Creaci贸n de intents y estados UI para c谩mara en Android con Kotlin

26

Implementaci贸n de funciones clave en ViewModel para c谩mara Android

27

Integrar C谩maraX en Jetpack Compose para Android

28

Captura y previsualizaci贸n de fotos en Android con Jetpack Compose

29

C贸mo Mostrar Fotos en Marcadores de Ubicaci贸n en Mapas con Jetpack Compose

Quiz: Integraci贸n c谩mara

Servicios en Android

30

Implementaci贸n de servicios en Android: normal services y foreground services

31

Implementar Foreground Services en Android para Persistencia en Segundo Plano

Quiz: Servicios en Android

Transmisiones en Android (Broadcast)

32

Implementaci贸n de BroadcastReceiver en Android para Escuchar Eventos del Sistema

33

Pruebas finales y cierre

You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesi贸n a prueba de IA

Antes: $249

Currency
$209
Suscr铆bete

Termina en:

2 D铆as
19 Hrs
15 Min
16 Seg

Creaci贸n de marcadores en Google Maps con Jetpack Compose

4/33
Resources

Incorporating interactive maps into Android apps is easy with Jetpack Compose. An essential aspect for any app that uses location is to create and manage visual markers directly on the map, indicating specific positions to guide users.

How to create a Composable for maps with Jetpack Compose?

To start, we will organize our elements by creating folders to facilitate the structuring of the code:

  • First, open your TrackIt project.
  • Create a folder or package called Presentation.maps.
  • Inside this folder, add a file called MapsSection to create your first Composable.

In this MapsSection function, use the following basic starter code:

@Composablefun MapsSection(modifier: Modifier)  {    GoogleMap(modifier  = modifier)}

If you are still not clear on how Composable works, you can check out the Jetpack Compose course available on Platzi beforehand.

How to configure map interactions in Android?

Jetpack Compose allows you to fine-tune the user experience by configuring various map features:

  • Use the UI Settings options, for example:
GoogleMap(    modifier  = modifier,     uiSettings  = MapUiSettings(zoomGesturesEnabled  = false))

With this setting, you disable the option to zoom the map, allowing only scrolling.

  • It also has events that notify actions, for example, when the map has finished loading:
GoogleMap(    modifier  = modifier,    onMapLoaded  =  {        val activity  = LocalActivity.current        Toast.makeText(activity, "Map Loaded", Toast.LENGTH_SHORT).show()     }) )

When executing this code, a small message(Toast) will appear informing that the map is already loaded.

How to add custom markers to the map?

To display specific markers in specific regions of the map, we must follow these steps:

  1. Create a state to locate the marker:
val markerState  = rememberMarkerState()LaunchedEffect(Unit)  {    markerState.position  = LatLng(4.65,  -74.0)}
  1. Insert marker visually:
GoogleMap(modifier  = modifier)  {    Marker(        state  = markerState     )  {        Box(            modifier  = Modifier                .size(35.dp)                .background(MaterialTheme.colorScheme.primary, shape  = CircleShape),            contentAlignment  = Alignment.Center         )  {             Icon(                imageVector  =  Icons.Default.Camera,                contentDescription  =  null,                tint  = MaterialTheme.colorScheme.onPrimary,                modifier  = Modifier.size(20.dp)            )        }    } } }}

This custom marker will be displayed as a circle with a camera icon in the center, useful for applications focused on camera interaction with location.

This way, you have your first interactive marker clearly located on the map, paving the way for adding routes, real-time tracking and other interesting features.

Share in comments how you did implementing these features in your Jetpack Compose application.

Contributions 0

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?