WEBVTT

00:00.120 --> 00:01.040
Welcome back.

00:01.080 --> 00:09.360
We created the Location Repository Location Repository implementation map, a view model and the location

00:09.360 --> 00:10.760
permission handler.

00:11.040 --> 00:14.480
Now let's move to the Uber Cloud map.

00:14.640 --> 00:19.000
And here inside the Uber clone map composable function.

00:19.000 --> 00:23.560
And before that Google map and the compose box compose layout.

00:23.720 --> 00:34.560
Create a new variable called user location by ViewModel dot user location dot collect as state, then

00:34.880 --> 00:41.720
request location call the request location permission composable function.

00:41.720 --> 00:46.640
Pass the ViewModel and here set the permission granted.

00:46.680 --> 00:48.240
Fetch the location.

00:48.240 --> 00:53.880
So here ViewModel dot start location updates.

00:53.880 --> 00:57.280
Here we created a variable called User location.

00:57.280 --> 01:05.560
I'm calling the user location and setting this collect as a state, because if we go to the ViewModel

01:05.560 --> 01:12.600
user location and here it's a state flow of lat long, we need to collect it as a state.

01:12.600 --> 01:19.080
So we use collect as a state in order to make it as a lat long.

01:19.120 --> 01:24.600
Okay, so this is how we get the user location in the composable.

01:24.800 --> 01:27.280
We requested the location permission checking.

01:27.320 --> 01:30.800
Passing the ViewModel and checking if it is guaranteed.

01:30.840 --> 01:33.920
Then go and start location updates.

01:33.960 --> 01:36.280
Okay, this is very simple.

01:36.280 --> 01:40.960
In order to draw a marker in the Google map.

01:40.960 --> 01:51.520
Composable setting and displaying the user location here inside the Google map, go and create a new

01:51.760 --> 01:54.240
user location dot.

01:54.280 --> 01:57.320
Let and set the marker marker.

01:57.320 --> 01:59.000
State the position.

01:59.000 --> 02:00.080
Which is it?

02:00.120 --> 02:01.320
You can uh.

02:02.840 --> 02:06.560
For simplicity and making everything looks fine.

02:06.600 --> 02:14.880
My current location and we can pass as a parameter and we can use it this instead of it in order to

02:14.920 --> 02:21.960
display and in order to understand what is it setting the current location as title.

02:22.120 --> 02:25.120
Also, let's make it in blue.

02:25.120 --> 02:32.200
So icon bitmap descriptor factory dot default marker.

02:32.440 --> 02:35.390
Set the bitmap descriptor.

02:35.390 --> 02:37.870
Factory to hue.

02:38.190 --> 02:38.710
Blue.

02:38.750 --> 02:45.790
Let's run our application and we have this error setting that is injected.

02:45.790 --> 02:49.990
This location repository is injected in ViewModel.

02:49.990 --> 02:55.510
And here we have location repository and it's requested.

02:55.510 --> 02:57.190
So there is an error.

02:57.470 --> 02:59.270
Inhaled components.

02:59.270 --> 03:04.430
Maybe I missed some annotations or I missed the module.

03:04.430 --> 03:07.270
So here interface repository.

03:07.310 --> 03:10.990
Scroll up inject map ViewModel.

03:11.150 --> 03:13.910
Health ViewModel location permissions.

03:13.950 --> 03:14.550
Clune.

03:14.750 --> 03:18.510
So the error is in the module.

03:18.550 --> 03:26.150
I didn't provide a module that inject the location repository in the map ViewModel.

03:26.430 --> 03:35.190
So here if you notice I used location repository and I used inject annotation, but I didn't tell Android

03:35.190 --> 03:38.870
and Hilt how to provide the location repository.

03:38.870 --> 03:43.830
I need to create a dependency and a module in order to run it.

03:43.870 --> 03:48.030
In the next video we're going to create it and run our application.
