Welcome back.
And this video, we are going to then finalize our applications functionality for the notification.
So let's go to my firebase messaging service because that's where the magic is going to happen.
You know, that part of the magic happens to the members activity, but now the rest of the magic is
going to happen here.
And that is in our sent notification.
So in this function here.
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
a title and a message, which I'm going to rename here.
It's not going to be message bodyboard.
It's going to be the message.
And before we do any more changes or make any more changes here in the.
Function on message received here.
I want to create a new entry.
All right, so this remote message data is not empty.
That's where I want to do some more than just logging it, because here I'm going to create a title
which will be a remote message dot data.
With constants that have seemed key.
Title.
And here we force the data.
So that's going to be the title.
Then I need the message so this, by the way, will be called once the message is received, right.
So on message received.
We need a title of the notification and then the message of the notification, we get that from remote
message dot.
Data.
Constants that I have CM's underscore key, underscore message.
And.
Here, of course.
It has to be written correctly so.
And our members activity, we sent the message right, so we prepared everything, and under the key
title, we created the title on our key message, we created a message and now it is my firebase messaging
service in on message received.
That's where we now get the data.
So you have to see the application as the receiver and also as the sender.
Right is both.
So it sends the data, but it's also receives the data because it's just one user who sends it and another
user who is receiving it.
So that's basically what we need to take care of, of both parts.
So here we are actually receiving we are receiving the remote message.
Now, this remote message has a bunch of data.
For example, the key key title.
So the title itself and the message of that remote message.
So now we want to use those to you, of course, in order to our send notification.
Function now, this might be a little bit.
Counter-intuitive that it's called sent notification, but basically we are sending a notification not
to the server, but actually to the user.
OK, so here this is just displaying the notification, so to speak, on the user's phone.
All right, and in this sent notification function, we had this.
Notification builder, to which we sent a title which we set default to title and in which we sent the
text, which we sent to default message.
So here we are, of course, now want to use the title that is passed to the function and the message
to this pastor to function.
OK, so as you can see here, we get the title once we call this function and we get the message.
And that's exactly what we did here.
So we passed the title and the message and we get those from the remote message which is given to us
once the message was received.
So once the phone received the message from the server, so from the firebase server, it will give
us all of the details that we sent to the server in the first place, which we did, and members activity.
OK, so with this crazy do in background async task, send notification to user async task class.
All right.
So.
We now finally need to make one little change to the intent inside of our sent notification here.
Because this intent should not just be there to call the quote directly from the application, but we
actually want to make sure that the intent is only given.
If we have a user who's logged in, OK, so this code here.
Should be run if the.
Fire store class.
And it's wires or glass that.
Get current user ID.
Is equal to or maybe better, is not empty, but is not empty, if that is the case, then create this
intent.
OK, and if it is anti.
So if the user is not logged in that we don't want to send him to the main activity, but we want to
send him to the sign in activity.
OK, so that's basically the idea behind this so intent, this sign in activity.
So we're just checking as user logged in said that the domain activity is not logged in the design that
activity.
And then before we actually launch the application, we want to make sure that the flags are correct
as well.
So here this intent clear top is one option.
The other options are intent, that flag activity, new task.
Or fly intent.
But.
Flag.
On the score activity, clear task.
So we want to make sure that.
The activities are not overlapping each other so that we don't have too many of the same activity open
and everything, so that, for example, if the use of press is the back button, that the application
actually works as intended, which means that there is only one main activity open at the same time
and not multiple instances of the main activity, for example.
And that is what we take care of with these lines here.
So if you want to know more about the individual flags, you can, of course, always check them out.
There is a good explanation of what those flags do.
All right, and now I'm just going to go ahead and test this application on my phone.
As well as on my pixel device.
OK, so this is an easy way to test the application.
If it actually sends you a notification, you can, of course, also create multiple Android virtual
devices.
So you have multiple emulators running at the same time and you can log in with one user to one of the
emulators and with the other user to the other.
And then you can just add the user to a list.
All right.
So add a member to the list.
OK, so let me.
Now, run it on the emulator as well here.
OK, well, it's running already, but I'm just going to rerun it so that it creates the latest built.
All right, so I'm going to check out a board where I don't have multiple members because we don't have
the functionality to the lead members yet, and that is something that you can add yourself if you want.
But I'm not going to do that.
And, of course, you know how to delete elements from the database and also or delete something from
the list and everything then.
We go to, let's say, board one.
I think I don't have anyone here.
Let's see, OK, only Homer's there, and now let me add someone to this board.
All right, so I'm just going to use text here in order to test this.
So here some some decks, even though it's not super big here, but I think it's still going to be fine.
So let me sign up with a new user.
So this one will be Mario and his name.
Email will be Mario at Gmail dot com.
And here, let me see.
Actually, how that works.
Gmail dot com and his password will be super secure.
So let's sign up, by the way, you can also add the functionality to sign up or the log in the user
directly once you sign up.
OK, Mario had.
Gmail dot com.
Let's log in.
All right, so that we are no boards are available now, let's add Maria to the board, Mario.
At.
And here I need you actually used to add Berten from their.
Agema, the complex at him.
And while I got a notification on the phone, there is Soheir.
They're at the bottom.
There it is.
OK, so assigned to the board or one you have been assigned to the board by Homer.
All right.
So I got this notification on my.
Phone here and I can see the index now, let's do it the other way around.
So here I'm going to create the new board, Marios Board.
Let's create that.
And now let's go to Martius Board.
Let's add a member to the board.
And here it's going to be then is at Gmail dot com.
Let's at this guy.
And let's see that we are so we have a new notification here at the top which says Assigned to the board,
Mariusz Board.
All right, so that is it for the notification to now know how to create your own notifications, how
to send them, how to display them and all of the good stuff.
At this point, it's free to you to optimize the app, to add new features, to extend it.
There are a bunch of things you could do.
You could, for example, add the feature to the lead members from a list, then add the feature to
drag and drop from one place to another.
There is a description to do that.
Then you can find a functionality to the leaderboard.
Well, actually, yeah, we don't have that.
So you could add that feature here to members because you have seen how to delete a card.
Right.
And deleting a board is pretty much the same thing.
So you can just go ahead and use that exact same feature.
And yeah, I mean, there are a bunch of other things that you could at, for example, here you could
add a due date information.
So when there are due dates or the latest due date or also when a due date is passed or nearby, you
could make the color of this whole board different or add a little indicator about the due date here
or whatever.
So there are a bunch of things that you could at.
Of course, you can also add the feature to add comments to a card or to add.
The functionality which allows you to upload elements or images or something like that to the card itself
and so forth, so all of these things that I just talked or told you is something that you can do already
except maybe for the drag and drop stuff.
But that is something where you wouldn't try to develop the code all by yourself, but you would probably
just use a third party library or you would just Google it and use the description that I can share
with you.
OK, but other than that, you know, everything that you need to know to build this application to
the way you like it or to be the way you like it, because you know how to upload data, you know how
to update data, to added data and so forth.
So deleting it and everything else, you know, all of the things that you need to know to build your
very own.
Application and it can have any feature you want at that point, because I think you have seen so many
different things, you have seen how to approach it.
If you want to build something, just Google it.
Just add something to the application that you would like to have.
Just go through the challenge.
Sometimes it just takes a little while.
Okay, but enough of that for me.
I thank you very much for being part of this course.
So see you in the next video where I'll have a little altro.
And if you want to make changes and you want to share those changes, please share them with us so that
the other students can also profit from it.
So thanks for that and see you hopefully in another course.