So finally, we got that token.
Now, here, we can retrieve that token
by accessing data.data,
because it's the data fields that holds the token.
And therefore, of course, if that's confusing,
you can, of course, alter rename that argument to response,
to access response data.
But ultimately that will be our token.
Now, we'll not need that token here for the moment,
instead, I wanna use it to manually
send a push notification to our real device.
And testing push notifications
is made easy with the Expo push notification tool.
You can find it if you search for
Expo push notifications.
This is a tool which allows you to test push notifications
you wanna send to your Expo projects.
In reality, you would probably not use this tool,
but you would use one of Expos server side STKs
to trigger a push notification on the server,
or you would send it from directly inside your app,
As I will show you later in this module,
depending on your use case.
But for testing, this is a great tool.
Now, as you see, it needs this push token
in this format, we just saw it.
So let's copy this push token,
this full string here, and insert it here.
That's the identifier of my device now.
And then we can enter a title.
This is a test. My first test message, as a body.
We could add extra data if we wanted to.
That should be in Jason format then though.
And we can also add iOS and Android specific information,
but for the moment, I'll just send this notification.
And now I'm sending this notification
whilst the app is in foreground.
It would also work if it's in background.
And you see here's the message delivered,
and we can tap it.
And if we do tap it,
we run that same code I showed you before
for the local notifications.
So that code for handling incoming
background or foreground notifications,
that code still executes,
and it still gives us access to the notification object
and all the notification data.
And that's in the end, all that's to it.
This is how we send push notifications
in an Expo application.
As you can see, it's really not that difficult,
thanks to Expo's own push server,
which in the end wraps those official servers,
and which has done all the nitty gritty details
of registering itself with those official service for us.
Instead, we just use these convenient methods I showed you,
and we can deliver push notifications.
Now, let me show you how we can trigger push notifications
from inside the app.