1
00:00:00,380 --> 00:00:01,200
Hire one.

2
00:00:01,320 --> 00:00:07,790
So in this story are you going to take a look at our maps activity that we created in the previous tutorial.

3
00:00:08,070 --> 00:00:14,460
So let's actually double click on the step here that has maps activity there so that this area is actually

4
00:00:14,460 --> 00:00:22,380
voiture and you can see that we have this maps activity class that extends fragment activity and implements

5
00:00:22,470 --> 00:00:25,320
on map ready callback interface.

6
00:00:25,440 --> 00:00:26,070
Right.

7
00:00:26,160 --> 00:00:32,870
And you can see that this instance variable is already created for us private Google map a map.

8
00:00:32,950 --> 00:00:35,370
So map means actually a member variable.

9
00:00:35,370 --> 00:00:36,870
This means member.

10
00:00:37,020 --> 00:00:40,250
So this is actually another name for instance variables.

11
00:00:40,530 --> 00:00:45,210
And here you can see that we have this uncreate method here.

12
00:00:45,210 --> 00:00:49,530
So first it's going to actually call this superadded uncreate method and then it's going to call the

13
00:00:49,530 --> 00:00:52,640
set content if you are totally out of that activity Underland map.

14
00:00:52,640 --> 00:00:59,310
So this is the XML file that is actually generated for us when we created this activity and we have

15
00:00:59,310 --> 00:01:05,700
this support map fragment map fragment get support map fragments managers that find fragments by ID

16
00:01:05,720 --> 00:01:12,900
or ID that map and is going to actually call this map a cinch Meffert on this map fragment here and

17
00:01:12,900 --> 00:01:15,170
it's going to pass the context here which is this.

18
00:01:15,510 --> 00:01:21,600
So these codes are necessary if you want to actually use the maps in Android.

19
00:01:21,600 --> 00:01:24,530
So that's why you see the maps on your emulator.

20
00:01:24,540 --> 00:01:27,650
When we actually land the application into previous tutorials.

21
00:01:28,080 --> 00:01:33,830
So now we can see that we have these interface on the map for the callback interface.

22
00:01:33,930 --> 00:01:41,200
So let's open our Android documentation's And let's see what is this on my pretty callback interface.

23
00:01:41,430 --> 00:01:43,970
So here we can see that this is the android documentation.

24
00:01:44,010 --> 00:01:51,630
So inside the search bar let's search for unmap ready on map ready.

25
00:01:52,670 --> 00:01:54,750
Call interface so let's click on it.

26
00:01:55,130 --> 00:01:56,720
Let's wait a little bit here.

27
00:01:57,620 --> 00:02:01,240
And here it says public interface on my protocol.

28
00:02:01,640 --> 00:02:05,580
Colorizing interface for forwent the map is ready to be used.

29
00:02:05,780 --> 00:02:06,300
OK.

30
00:02:06,470 --> 00:02:14,180
Once an instance of this interface is set on a map fragment or map view object the unmap ready Google

31
00:02:14,180 --> 00:02:18,220
Map method is triggered when the map is ready to be used.

32
00:02:18,350 --> 00:02:22,200
And provides a non-null instance of Google map.

33
00:02:22,520 --> 00:02:30,980
So this actually the interface here is actually going to be called when the map is ready.

34
00:02:30,980 --> 00:02:31,410
Right.

35
00:02:31,430 --> 00:02:35,350
So for example if I show you the emulator you can see that the map is right here right.

36
00:02:35,510 --> 00:02:37,680
And this means that the map is now ready.

37
00:02:37,700 --> 00:02:39,790
And if you go back to I understood you.

38
00:02:39,890 --> 00:02:45,200
So instead this interface we have in effect that must be implemented here and that if it is this one

39
00:02:45,500 --> 00:02:46,820
on map ready.

40
00:02:46,910 --> 00:02:52,050
So when the map is ready and can be actually shown to the user this method is going to be called.

41
00:02:52,400 --> 00:02:57,130
And this means that the codes inside the inside of this movie is going to be executed.

42
00:02:57,380 --> 00:03:03,650
So you can see that first it's going to initialize this map instance variable by passing the Google

43
00:03:03,650 --> 00:03:09,860
Map argument to this area but to this instance variable and it says add a marker in Sydney and move

44
00:03:09,860 --> 00:03:10,790
the camera.

45
00:03:10,790 --> 00:03:17,120
So first it's going to actually specify the latitude and longitude of the specific location that the

46
00:03:17,600 --> 00:03:22,490
map is going to that the map is going to actually show it to the user that specific location.

47
00:03:22,490 --> 00:03:26,820
So by default the location is in Sydney Australia.

48
00:03:27,110 --> 00:03:32,350
So you can see that the latitude is this route and the longitude is this value and it's going to actually

49
00:03:32,450 --> 00:03:34,970
add a marker to that specific location.

50
00:03:34,970 --> 00:03:39,110
So new options that position certainly the total market in Sydney.

51
00:03:39,260 --> 00:03:44,570
So let me show you that the emulator so you can see that this market here is in Sydney.

52
00:03:44,570 --> 00:03:49,020
And if I actually click on this here you can see that it's a market in Sydney.

53
00:03:49,040 --> 00:03:51,080
So this is the title right.

54
00:03:51,260 --> 00:03:56,930
And it has a map to move camera chamcha update's factory that Noul at length Sydney.

55
00:03:57,110 --> 00:04:02,360
So it's going to actually move the camera to this specific location here inside our map if you want

56
00:04:02,360 --> 00:04:05,640
to I can actually change the place of this camera here.

57
00:04:05,720 --> 00:04:11,270
But if you put this code here and map that move camera you are actually calling this live on this map

58
00:04:11,510 --> 00:04:16,500
and it's going to move this camera to this specific location here right Sidney.

59
00:04:16,540 --> 00:04:22,290
So that's on here let us go back to and read documentation.

60
00:04:22,340 --> 00:04:26,900
So now it's as if Google Play services is not installed on the device.

61
00:04:26,900 --> 00:04:29,470
The user will be prompted to install it.

62
00:04:29,750 --> 00:04:38,120
And the unmap ready if it will only be triggered when the user has installed it and returns to the app.

63
00:04:38,450 --> 00:04:45,610
So it says publish if it's somebody on my thready right so called Vandemark is ready to be used.

64
00:04:46,410 --> 00:04:50,340
So you can actually read these documentations here.

65
00:04:50,360 --> 00:04:53,770
So let's go back to our Android studio here.

66
00:04:53,900 --> 00:04:59,450
And here I just wanted to actually give you some explanations about this activity the Smurfs activity

67
00:04:59,450 --> 00:05:06,110
that is actually created here that we just created in the previous tutorials and you can see that these

68
00:05:06,110 --> 00:05:09,110
codes are generated for us automatically.

69
00:05:09,110 --> 00:05:09,470
Right.

70
00:05:09,590 --> 00:05:12,100
You can you can also read these comments here.

71
00:05:12,350 --> 00:05:15,340
It says manipulates the map of what's available.

72
00:05:15,410 --> 00:05:17,990
This callback is triggered and the map is ready to be used.

73
00:05:17,990 --> 00:05:24,050
So you can see that we have also have a description of this on my protocol interface.

74
00:05:24,080 --> 00:05:28,880
This is where we can add markers or lines of listeners or move the camera.

75
00:05:28,880 --> 00:05:32,900
In this case we just add a mulcher near Sydney Australia.

76
00:05:33,110 --> 00:05:38,540
If Google Play services is not installed on the device the user will be prompted to install it and install

77
00:05:38,570 --> 00:05:41,220
Google Play services and return to the map.

78
00:05:41,270 --> 00:05:42,350
So that's it.

79
00:05:42,350 --> 00:05:46,800
And I think that's enough for the situation if you have any questions about the concepts that they touch

80
00:05:46,820 --> 00:05:49,000
in this lesson and please post discussion in of course.

81
00:05:49,250 --> 00:05:51,440
And then I do my best to answer all of your questions.

82
00:05:51,440 --> 00:05:54,780
Thank you very much for watching and I'll see you in the next tutorial.

