1
00:00:00,510 --> 00:00:01,180
Welcome back.

2
00:00:01,470 --> 00:00:07,290
And this video, we are going to then finalize our applications functionality for the notification.

3
00:00:07,290 --> 00:00:12,990
So let's go to my firebase messaging service because that's where the magic is going to happen.

4
00:00:13,290 --> 00:00:17,730
You know, that part of the magic happens to the members activity, but now the rest of the magic is

5
00:00:17,730 --> 00:00:18,680
going to happen here.

6
00:00:20,310 --> 00:00:23,160
And that is in our sent notification.

7
00:00:23,600 --> 00:00:24,960
So in this function here.

8
00:00:26,090 --> 00:00:33,010
So now we don't only want to have a message body, but we also want to have a title, so let's put in

9
00:00:33,020 --> 00:00:36,790
a title and a message, which I'm going to rename here.

10
00:00:36,800 --> 00:00:38,330
It's not going to be message bodyboard.

11
00:00:38,330 --> 00:00:39,680
It's going to be the message.

12
00:00:41,060 --> 00:00:46,550
And before we do any more changes or make any more changes here in the.

13
00:00:47,580 --> 00:00:50,560
Function on message received here.

14
00:00:51,030 --> 00:00:53,310
I want to create a new entry.

15
00:00:53,460 --> 00:00:57,640
All right, so this remote message data is not empty.

16
00:00:57,990 --> 00:01:05,910
That's where I want to do some more than just logging it, because here I'm going to create a title

17
00:01:06,480 --> 00:01:10,200
which will be a remote message dot data.

18
00:01:11,120 --> 00:01:14,480
With constants that have seemed key.

19
00:01:16,010 --> 00:01:16,460
Title.

20
00:01:19,920 --> 00:01:21,610
And here we force the data.

21
00:01:21,930 --> 00:01:23,370
So that's going to be the title.

22
00:01:24,560 --> 00:01:31,220
Then I need the message so this, by the way, will be called once the message is received, right.

23
00:01:31,230 --> 00:01:33,290
So on message received.

24
00:01:34,870 --> 00:01:40,510
We need a title of the notification and then the message of the notification, we get that from remote

25
00:01:40,510 --> 00:01:41,260
message dot.

26
00:01:42,330 --> 00:01:42,930
Data.

27
00:01:44,290 --> 00:01:50,170
Constants that I have CM's underscore key, underscore message.

28
00:01:51,690 --> 00:01:52,380
And.

29
00:01:53,870 --> 00:01:54,890
Here, of course.

30
00:01:56,840 --> 00:01:59,660
It has to be written correctly so.

31
00:02:00,790 --> 00:02:07,660
And our members activity, we sent the message right, so we prepared everything, and under the key

32
00:02:07,690 --> 00:02:14,080
title, we created the title on our key message, we created a message and now it is my firebase messaging

33
00:02:14,080 --> 00:02:15,960
service in on message received.

34
00:02:16,210 --> 00:02:18,590
That's where we now get the data.

35
00:02:18,610 --> 00:02:23,560
So you have to see the application as the receiver and also as the sender.

36
00:02:23,560 --> 00:02:24,430
Right is both.

37
00:02:24,430 --> 00:02:30,610
So it sends the data, but it's also receives the data because it's just one user who sends it and another

38
00:02:30,820 --> 00:02:32,440
user who is receiving it.

39
00:02:32,450 --> 00:02:36,880
So that's basically what we need to take care of, of both parts.

40
00:02:37,150 --> 00:02:41,430
So here we are actually receiving we are receiving the remote message.

41
00:02:41,650 --> 00:02:43,870
Now, this remote message has a bunch of data.

42
00:02:44,200 --> 00:02:47,410
For example, the key key title.

43
00:02:47,410 --> 00:02:51,020
So the title itself and the message of that remote message.

44
00:02:51,040 --> 00:02:57,640
So now we want to use those to you, of course, in order to our send notification.

45
00:02:59,020 --> 00:03:02,380
Function now, this might be a little bit.

46
00:03:04,560 --> 00:03:10,380
Counter-intuitive that it's called sent notification, but basically we are sending a notification not

47
00:03:10,380 --> 00:03:12,840
to the server, but actually to the user.

48
00:03:12,870 --> 00:03:20,400
OK, so here this is just displaying the notification, so to speak, on the user's phone.

49
00:03:22,690 --> 00:03:26,350
All right, and in this sent notification function, we had this.

50
00:03:27,250 --> 00:03:34,180
Notification builder, to which we sent a title which we set default to title and in which we sent the

51
00:03:34,720 --> 00:03:37,210
text, which we sent to default message.

52
00:03:37,510 --> 00:03:42,100
So here we are, of course, now want to use the title that is passed to the function and the message

53
00:03:42,100 --> 00:03:43,260
to this pastor to function.

54
00:03:43,840 --> 00:03:50,080
OK, so as you can see here, we get the title once we call this function and we get the message.

55
00:03:50,080 --> 00:03:51,460
And that's exactly what we did here.

56
00:03:51,470 --> 00:03:57,820
So we passed the title and the message and we get those from the remote message which is given to us

57
00:03:57,820 --> 00:03:59,570
once the message was received.

58
00:03:59,950 --> 00:04:06,250
So once the phone received the message from the server, so from the firebase server, it will give

59
00:04:06,250 --> 00:04:11,990
us all of the details that we sent to the server in the first place, which we did, and members activity.

60
00:04:12,670 --> 00:04:19,959
OK, so with this crazy do in background async task, send notification to user async task class.

61
00:04:20,140 --> 00:04:20,550
All right.

62
00:04:21,160 --> 00:04:21,579
So.

63
00:04:23,150 --> 00:04:30,560
We now finally need to make one little change to the intent inside of our sent notification here.

64
00:04:33,220 --> 00:04:41,950
Because this intent should not just be there to call the quote directly from the application, but we

65
00:04:41,950 --> 00:04:46,120
actually want to make sure that the intent is only given.

66
00:04:48,730 --> 00:04:56,320
If we have a user who's logged in, OK, so this code here.

67
00:04:58,050 --> 00:05:00,960
Should be run if the.

68
00:05:03,240 --> 00:05:05,850
Fire store class.

69
00:05:06,900 --> 00:05:11,030
And it's wires or glass that.

70
00:05:12,450 --> 00:05:14,550
Get current user ID.

71
00:05:15,860 --> 00:05:25,400
Is equal to or maybe better, is not empty, but is not empty, if that is the case, then create this

72
00:05:25,400 --> 00:05:25,840
intent.

73
00:05:26,730 --> 00:05:28,290
OK, and if it is anti.

74
00:05:30,470 --> 00:05:35,210
So if the user is not logged in that we don't want to send him to the main activity, but we want to

75
00:05:35,210 --> 00:05:37,430
send him to the sign in activity.

76
00:05:37,880 --> 00:05:44,840
OK, so that's basically the idea behind this so intent, this sign in activity.

77
00:05:45,940 --> 00:05:50,980
So we're just checking as user logged in said that the domain activity is not logged in the design that

78
00:05:50,980 --> 00:05:51,520
activity.

79
00:05:52,860 --> 00:06:00,360
And then before we actually launch the application, we want to make sure that the flags are correct

80
00:06:00,360 --> 00:06:00,800
as well.

81
00:06:01,170 --> 00:06:04,650
So here this intent clear top is one option.

82
00:06:05,040 --> 00:06:11,370
The other options are intent, that flag activity, new task.

83
00:06:12,930 --> 00:06:15,480
Or fly intent.

84
00:06:18,620 --> 00:06:19,070
But.

85
00:06:20,820 --> 00:06:21,390
Flag.

86
00:06:23,270 --> 00:06:26,180
On the score activity, clear task.

87
00:06:29,310 --> 00:06:30,930
So we want to make sure that.

88
00:06:32,520 --> 00:06:39,510
The activities are not overlapping each other so that we don't have too many of the same activity open

89
00:06:39,510 --> 00:06:44,190
and everything, so that, for example, if the use of press is the back button, that the application

90
00:06:44,220 --> 00:06:50,250
actually works as intended, which means that there is only one main activity open at the same time

91
00:06:50,430 --> 00:06:53,670
and not multiple instances of the main activity, for example.

92
00:06:55,840 --> 00:06:58,570
And that is what we take care of with these lines here.

93
00:06:58,870 --> 00:07:02,500
So if you want to know more about the individual flags, you can, of course, always check them out.

94
00:07:02,530 --> 00:07:05,440
There is a good explanation of what those flags do.

95
00:07:08,630 --> 00:07:13,970
All right, and now I'm just going to go ahead and test this application on my phone.

96
00:07:15,120 --> 00:07:16,920
As well as on my pixel device.

97
00:07:17,430 --> 00:07:20,940
OK, so this is an easy way to test the application.

98
00:07:20,940 --> 00:07:26,400
If it actually sends you a notification, you can, of course, also create multiple Android virtual

99
00:07:26,400 --> 00:07:27,090
devices.

100
00:07:27,090 --> 00:07:33,870
So you have multiple emulators running at the same time and you can log in with one user to one of the

101
00:07:33,870 --> 00:07:36,180
emulators and with the other user to the other.

102
00:07:36,690 --> 00:07:40,230
And then you can just add the user to a list.

103
00:07:40,680 --> 00:07:41,070
All right.

104
00:07:41,070 --> 00:07:42,900
So add a member to the list.

105
00:07:44,100 --> 00:07:45,360
OK, so let me.

106
00:07:48,030 --> 00:07:50,390
Now, run it on the emulator as well here.

107
00:07:51,950 --> 00:07:56,810
OK, well, it's running already, but I'm just going to rerun it so that it creates the latest built.

108
00:07:59,660 --> 00:08:06,080
All right, so I'm going to check out a board where I don't have multiple members because we don't have

109
00:08:06,080 --> 00:08:11,780
the functionality to the lead members yet, and that is something that you can add yourself if you want.

110
00:08:11,930 --> 00:08:12,950
But I'm not going to do that.

111
00:08:12,950 --> 00:08:17,330
And, of course, you know how to delete elements from the database and also or delete something from

112
00:08:17,330 --> 00:08:19,280
the list and everything then.

113
00:08:20,230 --> 00:08:22,540
We go to, let's say, board one.

114
00:08:24,030 --> 00:08:25,870
I think I don't have anyone here.

115
00:08:26,120 --> 00:08:33,250
Let's see, OK, only Homer's there, and now let me add someone to this board.

116
00:08:33,980 --> 00:08:38,419
All right, so I'm just going to use text here in order to test this.

117
00:08:39,049 --> 00:08:45,530
So here some some decks, even though it's not super big here, but I think it's still going to be fine.

118
00:08:45,530 --> 00:08:47,560
So let me sign up with a new user.

119
00:08:47,870 --> 00:08:50,680
So this one will be Mario and his name.

120
00:08:50,720 --> 00:08:54,200
Email will be Mario at Gmail dot com.

121
00:08:55,020 --> 00:08:56,450
And here, let me see.

122
00:08:57,790 --> 00:08:59,510
Actually, how that works.

123
00:08:59,590 --> 00:09:04,830
Gmail dot com and his password will be super secure.

124
00:09:04,840 --> 00:09:13,000
So let's sign up, by the way, you can also add the functionality to sign up or the log in the user

125
00:09:13,000 --> 00:09:14,680
directly once you sign up.

126
00:09:15,460 --> 00:09:17,440
OK, Mario had.

127
00:09:18,830 --> 00:09:20,120
Gmail dot com.

128
00:09:20,600 --> 00:09:21,410
Let's log in.

129
00:09:25,830 --> 00:09:33,930
All right, so that we are no boards are available now, let's add Maria to the board, Mario.

130
00:09:35,810 --> 00:09:36,290
At.

131
00:09:39,680 --> 00:09:43,550
And here I need you actually used to add Berten from their.

132
00:09:44,510 --> 00:09:46,160
Agema, the complex at him.

133
00:09:50,030 --> 00:09:54,860
And while I got a notification on the phone, there is Soheir.

134
00:09:57,130 --> 00:09:57,920
They're at the bottom.

135
00:09:57,940 --> 00:09:58,450
There it is.

136
00:09:58,480 --> 00:10:03,350
OK, so assigned to the board or one you have been assigned to the board by Homer.

137
00:10:03,880 --> 00:10:04,120
All right.

138
00:10:04,180 --> 00:10:06,250
So I got this notification on my.

139
00:10:07,410 --> 00:10:11,940
Phone here and I can see the index now, let's do it the other way around.

140
00:10:11,950 --> 00:10:16,110
So here I'm going to create the new board, Marios Board.

141
00:10:17,570 --> 00:10:18,560
Let's create that.

142
00:10:20,350 --> 00:10:22,300
And now let's go to Martius Board.

143
00:10:22,690 --> 00:10:24,670
Let's add a member to the board.

144
00:10:25,680 --> 00:10:30,210
And here it's going to be then is at Gmail dot com.

145
00:10:32,920 --> 00:10:34,240
Let's at this guy.

146
00:10:35,450 --> 00:10:41,270
And let's see that we are so we have a new notification here at the top which says Assigned to the board,

147
00:10:41,280 --> 00:10:42,050
Mariusz Board.

148
00:10:43,470 --> 00:10:50,430
All right, so that is it for the notification to now know how to create your own notifications, how

149
00:10:50,430 --> 00:10:54,870
to send them, how to display them and all of the good stuff.

150
00:10:57,070 --> 00:11:04,050
At this point, it's free to you to optimize the app, to add new features, to extend it.

151
00:11:04,180 --> 00:11:06,040
There are a bunch of things you could do.

152
00:11:06,160 --> 00:11:13,120
You could, for example, add the feature to the lead members from a list, then add the feature to

153
00:11:13,900 --> 00:11:16,420
drag and drop from one place to another.

154
00:11:16,810 --> 00:11:18,400
There is a description to do that.

155
00:11:18,970 --> 00:11:22,180
Then you can find a functionality to the leaderboard.

156
00:11:22,210 --> 00:11:24,720
Well, actually, yeah, we don't have that.

157
00:11:25,420 --> 00:11:29,590
So you could add that feature here to members because you have seen how to delete a card.

158
00:11:29,590 --> 00:11:29,890
Right.

159
00:11:30,160 --> 00:11:32,220
And deleting a board is pretty much the same thing.

160
00:11:32,230 --> 00:11:35,500
So you can just go ahead and use that exact same feature.

161
00:11:36,970 --> 00:11:42,010
And yeah, I mean, there are a bunch of other things that you could at, for example, here you could

162
00:11:42,010 --> 00:11:44,140
add a due date information.

163
00:11:44,140 --> 00:11:51,370
So when there are due dates or the latest due date or also when a due date is passed or nearby, you

164
00:11:51,370 --> 00:11:57,520
could make the color of this whole board different or add a little indicator about the due date here

165
00:11:57,520 --> 00:11:58,030
or whatever.

166
00:11:58,060 --> 00:11:59,890
So there are a bunch of things that you could at.

167
00:12:00,140 --> 00:12:06,190
Of course, you can also add the feature to add comments to a card or to add.

168
00:12:07,280 --> 00:12:15,530
The functionality which allows you to upload elements or images or something like that to the card itself

169
00:12:15,530 --> 00:12:22,730
and so forth, so all of these things that I just talked or told you is something that you can do already

170
00:12:22,940 --> 00:12:24,980
except maybe for the drag and drop stuff.

171
00:12:24,980 --> 00:12:30,320
But that is something where you wouldn't try to develop the code all by yourself, but you would probably

172
00:12:30,320 --> 00:12:36,470
just use a third party library or you would just Google it and use the description that I can share

173
00:12:36,470 --> 00:12:36,770
with you.

174
00:12:37,210 --> 00:12:43,010
OK, but other than that, you know, everything that you need to know to build this application to

175
00:12:43,010 --> 00:12:49,400
the way you like it or to be the way you like it, because you know how to upload data, you know how

176
00:12:49,400 --> 00:12:53,930
to update data, to added data and so forth.

177
00:12:53,940 --> 00:12:59,690
So deleting it and everything else, you know, all of the things that you need to know to build your

178
00:12:59,690 --> 00:13:00,620
very own.

179
00:13:01,630 --> 00:13:08,260
Application and it can have any feature you want at that point, because I think you have seen so many

180
00:13:08,260 --> 00:13:10,960
different things, you have seen how to approach it.

181
00:13:11,440 --> 00:13:14,020
If you want to build something, just Google it.

182
00:13:14,170 --> 00:13:17,680
Just add something to the application that you would like to have.

183
00:13:18,490 --> 00:13:19,900
Just go through the challenge.

184
00:13:20,200 --> 00:13:21,970
Sometimes it just takes a little while.

185
00:13:22,660 --> 00:13:24,620
Okay, but enough of that for me.

186
00:13:24,680 --> 00:13:27,080
I thank you very much for being part of this course.

187
00:13:27,080 --> 00:13:30,100
So see you in the next video where I'll have a little altro.

188
00:13:30,370 --> 00:13:35,950
And if you want to make changes and you want to share those changes, please share them with us so that

189
00:13:36,220 --> 00:13:38,670
the other students can also profit from it.

190
00:13:38,980 --> 00:13:42,670
So thanks for that and see you hopefully in another course.

