Welcome back.
We created the Location Repository Location Repository implementation map, a view model and the location
permission handler.
Now let's move to the Uber Cloud map.
And here inside the Uber clone map composable function.
And before that Google map and the compose box compose layout.
Create a new variable called user location by ViewModel dot user location dot collect as state, then
request location call the request location permission composable function.
Pass the ViewModel and here set the permission granted.
Fetch the location.
So here ViewModel dot start location updates.
Here we created a variable called User location.
I'm calling the user location and setting this collect as a state, because if we go to the ViewModel
user location and here it's a state flow of lat long, we need to collect it as a state.
So we use collect as a state in order to make it as a lat long.
Okay, so this is how we get the user location in the composable.
We requested the location permission checking.
Passing the ViewModel and checking if it is guaranteed.
Then go and start location updates.
Okay, this is very simple.
In order to draw a marker in the Google map.
Composable setting and displaying the user location here inside the Google map, go and create a new
user location dot.
Let and set the marker marker.
State the position.
Which is it?
You can uh.
For simplicity and making everything looks fine.
My current location and we can pass as a parameter and we can use it this instead of it in order to
display and in order to understand what is it setting the current location as title.
Also, let's make it in blue.
So icon bitmap descriptor factory dot default marker.
Set the bitmap descriptor.
Factory to hue.
Blue.
Let's run our application and we have this error setting that is injected.
This location repository is injected in ViewModel.
And here we have location repository and it's requested.
So there is an error.
Inhaled components.
Maybe I missed some annotations or I missed the module.
So here interface repository.
Scroll up inject map ViewModel.
Health ViewModel location permissions.
Clune.
So the error is in the module.
I didn't provide a module that inject the location repository in the map ViewModel.
So here if you notice I used location repository and I used inject annotation, but I didn't tell Android
and Hilt how to provide the location repository.
I need to create a dependency and a module in order to run it.
In the next video we're going to create it and run our application.