hello everyone welcome back to the channel in today's video I want to show you how to use Expo notifications with EAS Expo application Services we're going to learn how to configure our credentials especially with a new version of Firebase Cloud messaging for Android there's a lot of confusion right now on how to integrate push notifications so in this video we're going to learn how to set them up and we're going to learn as well how to set our credentials using Firebase for Android and then we're going to learn how to test this on real devices
we're going to triggering some push notifications using the Expo tool so let's see the demo all right guys so here as you can see I have my iPhone and I'm streaming the screen so as you can see there and I'm also have a real device by the way this is very important you need a real device to test this otherwise you won't be able to see if your push notifications are working we have two development builds that we created using Expo EAS um and let's see how this works so for example on the left I
already have uh here the push notification of Expo and you can just go to this website which is Expo dep uh SL notifications and this is a tool that Expo provides to test to quickly test sending push notifications so here I have the push token by the way um you shouldn't share the Expo token but since I'm going to delete this app it's okay if you see it um so this is my Expo token for my Android device and if I scroll down you can see that the message title for this notification is code with
ble and then we can add a body so for example hello world and then we can send some data as well and some specific um platform specific settings like for example iOS you can have a subtitle so I can say message subtitle and then we can also have a batch count so let's say that I want to have 10 since I already have one as you can see there on the right then we can play a sound and for Android we can select the channel ID I'll just use the default um and then very important
like like as I was mentioning before like last month or this month Firebase Club messaging Legacy is not working anymore so now we have fireb Cloud messaging version one and by the way by default uh the default Behavior will not force sending the push notification via the uh legac uh by the way it's going to send it uh via the Legacy API but if the uh Legacy credential exist right only otherwise it's going to be using the version one in this case we're going to be using version version one of course so let's go ahead
and send a bu notification and I should be able to get to get it here in my Android device as you can see there and if I swipe down you can see that it says code BTO and hello world is is the subtitle no it's the body okay now let's see the same thing with iOS so for iOS what I'll do is just open the app and just shake my device reload and I'll just go to the terminal copy this push token and then just come here replace it and just to show you that this
is working I'll just create a message title let's say I um message body hello we can add a subtitle for IOS as you can see there and batch count is going to be 10 so let me bring it back I have to close the app so that we can see the notification okay so let's send a notification there we have it so this is how it looks on iOS let's open and the batch is working as you can see here we have 10 all right so that's the demo guys let's now jump and see how
we can do this so the first thing that I want to do is just uh maximize here my browser and I'll go to Firebase because we need to create a new Firebase project for this all right so here I am in my console in Firebase I'm guessing you already have an account so just go ahead and sign in and let's create a new project I'll name this one um notifications tutorial for example and then continue now I'll turn off of course we don't need him let's create a project this is going to take a moment
so let's wait all right our Firebase project is ready let's hit continue and now we are inside this project okay now this step is only for Android so what I want to do here is just go to the settings here on the left project settings from here let's select service accounts okay let me close this on the left let's scroll down here and generate a new private key okay so be careful with this key because if you lose it you can't recover it so let's go ahead and click generate now let's check the downloads all
right so in my downloads guys as you can see here I have now this um Json file that contains credentials for my project since I'm going to be using Expo application services or EAS to build my application I need to make this available on EAS so let's go ahead and uh by the way I'm using this guide to guide myself on how to do this and you can check it as well if you want to follow along with me in the push notifications documentation of Expo you can find the a Android Firebase Cloud messaging version
one credentials okay so the first thing that we need to do once we have this credential is actually upload this to a as as I was mentioning before but before I do that we need to create a new app right so let's create a new app for this example okay so I'll create a notifications tutorial application just to show you how we can do this all right and the project is ready so I'll just go ahead and CD into the notifications tutorial um and then I'll open this in vs code the next thing that I'll
do is just make sure that I'm using my esas credentials the correct ones for this project so I'll just say EAS who am I and by the way if you don't have the CLI EAS CLI you can install it by saying mpm install uh Global EAS CLI okay so to make sure that you have EAS clis so now I can say who am I and hit enter to make sure that I'm using the account that I want to use for this case in this case I want to use Betto at Expo this is my account
um so now I want to initialize a new e project so let's say EAS in it and hit enter I'll select my account Betto at Expo and then would you like to create a project for this uh specific new app that we just created so I'll go ahead and say yes and this is going to create my project and um here if you can see in the app. Json if I scroll down this is going to add this extra information which is going to contain my project ID from E and the owner as well okay
so now with this ID we can start configuring our builds so now let's say Eis build configure I believe this is the command that I want and I'll configure all platforms and hit enter what this is doing is just creating an e. Json file in this file we can configure specific flows and profiles when we are um building applications using EAS so by we have development preview and production and this is how it looks it's a very simple uh file okay so now once we have this I'll go ahead and run e credentials as you
can see here on the left right so let's go ahead and hit enter um now select the platform in this case Android um the profile in this case would be production and uh specify Android package okay so it needs by the way and let me quit this I forgot we need to specify a uh package so if we go to the app. Json we have IOS and Android and for iOS we can go ahead and add a bundle identifier like this and for Android we need to specify the package so in this case I will
leave the same one okay okay so I think I made a mistake it's telling me that I'm using uh invalid name for Android yeah so it seems that we cannot use this um Dash so let's go ahead and remove it in both platforms let's quit this and try again I'll select Android production all right now we need to select um Google service account and then uh Google service account um key or push notification let's go ahead and select that let me make this a bit bigger so that we can see a bit better and uh
let's click on set up Google service account for push notification and then upload a new service account key for this app now we need to specify the path okay now if you remember we have that in the downloads this is the file that we need to upload now of course you want to be careful with this file for now what I'll do is just put it in my root folder and I'll just close it um close this as well and you can go ahead and add this to your G ignore if you want uh but
to upload it to EAS we can simply specify the path by copying the name of this file so for example I'll just copy the name then come back here and say oops and say B the name. Json this is going to grab it from my root folder and it's going to upload it so let's go ahead and hit enter okay there we go okay and those are the credentials that EAS is going to need once we build our application now we can just go ahead and contrl z and let's go back to Firebase we generated
our key now we need to go back to the general section of the application and we need to connect the Android application so in the apps let's select Android now we need to specify the package if you remember we created this package so let's go ahead and copy let me close this I'll copy this package command C command B the name of my app notifications example and we need to specify the signning certificate required so to get this uh certificate it's actually I think very easy if we just go to the Expo dashboard so let's
go to expo. Dev and here I am in my Expo dashboard I'm going to select my notifications tutorial project which is the first one that we have here and as you can see I don't have anything we have builds and we can select all builds and I don't have anything yet and on the left as you can see we can scroll down to the configuration and then select credentials now in this case we don't have anything yet we only have this um I think Android now we don't have any credentials for this application because we
haven't created any build for Android so I think the way we can fix this is by just triggering a new build for Android by saying es build and then say um platform Android and hit enter so this is doing it's going to ask me to generate a new Android key store so let's go ahead and select yes in this case this is a new application of course and if you already have an application that already contains a key store um you can use that one okay now in this case we generated this new key store
so if I come back here and reload on the credentials tab you can see that now I have this Android key store and by way I can go to my builds all builds and I can see the one that I just triggered using the CLI so let's go ahead and cancel this one um I can just click on these three dots and then cancel cancel build and yeah we're good I think this should stop now okay it was cancelled okay now let's go back to the credentials um let's select Android and let's copy our key
store so in this case we need the s ha 256 so I'll just click on copy here and let's go back to Firebase now let's paste that in here S sh1 I think I copied the wrong thing yeah I need the fingerprint okay let's go back I copi the wrong one let's paste it here this is the correct one yeah so before I do that I need to provide my package again so let's go to the code um and let's copy the package package name for Android let's put in here and now we can register
this application all right now we can download this Google service Json and this is going to be a new file that we need to um drag and drop to our application so let's go to the downloads now I have these Google services Json and let me go back to the code let me open the Explorer I cancel the build as you can see here I'll clear the terminal so that we don't get confused and um let's go ahead and drag and drop these Google services file okay now um I uploaded this file that contains my
keys and all that to EAS so that means that I don't need this anymore in here so I'll just go ahead and delete it of course I know that I have a copy in my downloads so be careful on that now the Google service. Json it's a file that most of the time you won't want this to be on GitHub and you have to be careful as well because this contains credentials so um what I want to do in here is add this to my um git ignore okay so let's go to the git ignore
and down here we can say I don't want to track the Google services um Json and by the way um now that I'm here I'll just add the IOS and Android folder in case I need to in case I want to build these two um folders in the future but I'm going to be using as so I don't think I'll be doing that but yeah you want you can add them if you want to so the Google services now uh this is a tricky one because we don't want to push Google services to GitHub but
we do want to push um Google services to EAS right so EAS is going to ignore all the files that we have in the G ignore when we trigger a build which means if we add the Google services Json um we won't have access to this file to set up our credentials for push notifications once we trigger the build so the way we can fix that it's by creating a new file and I'll call this one EAS ignore EAS ignore it's a file that we can use to ignore files but in this case for EAS
now this is great because we are overwriting now the G ignore uh functionality of course most of the time you would want to just copy and come to the EAS ignore file and paste everything so I'm just copying everything from get ignore but in this case I want to include the Google services Json so we go ahead and delete this this means that I'm going to push everything including the Google services once I trigger the build so once we trigger the build we're pushing the code including the uh uploading the code to e servers including
the Google services which means theoretically this should work when we create the build okay so that's one way to do it or the other one could be just uploading the um Google services to EAS we can do that as well uh by uploading credentials and you can learn more in the in their documentation in the Expo dos so let's go ahead and close this EAS ignore for now let's close these Google services now the next thing that I'll do is just click on next here on my Firebase and then we need to add the um
Firebase SDK and let's script scrolling down um I think from here what I'll do is just click next and then continue to console so we did that and then we went to create a configured the Google services file that's done we downloaded it we added to the project now um it is in the root folder right so we need to add the same thing uh I mean we need to specify the Google services file into the app. Json so let's go ahead and do that I'll go to the app the Json inside Android I'll create
a new item and then add a comma here hit save now the path to my Google services is going to be in my root folder so I can simply say/ Google services. Json make sure that it's the same name that you have in here and once we have this we should be good so I'll just go ahead and press save and then let's scroll down and now we're all set we should be able to send push notifications and we are good to start integrating this so let's go to the notifications here I think I can
just go to the overviewing in the dogs and then we can go to the setup we need to install some dependencies so let me make this a bit bigger just to make sure that we are able to see what's going on here so in the install libraries H we're going to need Expo push notifications I mean Expo notifications then Expo device Expo device is just to make sure that we are using this on a real device and this library is going to help us do that um because this is not going to work on simulators
or emulators right then we also have Expo constants this one is used to get the project ID value from the app config okay so let's go ahead and copy this let's go to the um project and install these dependencies using npx Expo install okay cool now the next thing um here we have a minimal example by the way uh but the next thing that I want to do it's I mean the approach that I want to use for this video is to create a provider that is going to allow the application to pass down the
push token okay so let's do that and I'll go ahead and create a new folder on my route and I'll call this one context I'll create a new folder once we are here and I'll call this one utilities or utils and inside this one I'll create a new file and and this file is for register register or push defications a sync dots so I'm just abstracting or I want to abstract the logic of registering the device for push notifications and I'll just go ahead and paste some coding here and let's work through this code to
make sure that everyone understands what's going on in here this is going going to be a function called register for push notifications and we are importing all as notifications from Expo notifications we are using here the Expo device and Expo constants and as well the platform now something very important to keep in mind is that for Android in order before we can actually start sending notifications or before we can even ask if we can send them notifications we need to set a a channel that's why we have here in the first line if the platform
is Android we are using the method that comes with the notifications from Expo set notification Channel async and this is going to assign a channel configuration the channel name is default and you can change this if you want to and you can create more channels but we need at least one so we're going to be using the default one and um and this is going to be created if need to be created if it needs to be created okay so we're defining the the default Channel and then we are defining the importance this is another
important um thing because if you set the priority to low in some cases it could be that the devices or Android devices won't get a notification so make sure that you set this to Max and if I say dot you can see that we have High Low Max mean in or none so in this case we're going to be using Max vibration pattern I would say you can customize this I don't really know what this is doing and then we can also specify a light color I'll just leave those defaults and then next validation that
we want to do is check if we are in a real device so that's why we're using device and if we are in a real device we are going to grab the status of the permissions of the notifications in this case we're using the get permissions async and then we're storing the final status in this variable okay so then with the existing status we are checking if it's not granted then we are going to request permissions okay so if the status is granted um or well after this we're going to get the status and then
we're going to assign it to the variable that we defined here if the status is not granted we're just going to throw an error because at this point we want to you know the purpose of this application is to show the notifications and if the user does not allow so we cannot do anything but in in your case maybe you want to show an alert or maybe you want to do something else now the next thing is grab the project ID for this uh project okay and this is for E we're using e so we
are grabbing this using the constants we're grabbing the project ID and once we have the project ID we can um get the Expo push token now the project ID is so that uh we're using the pr ID so that Expo can know more data about our application how many notifications we are sending and then based on this data they can show us some uh graphs and some some UI that we can check on the Expo Dev dashboard about the delivery of the notifications and things like that so we are getting the uh push token once
we have the push token we are putting it in the console because now we are Deb in and we want to copy the the token and go to the Expo notifications tool to trigger some notifications okay so this is just returning the um the push token and that's it then we also have some trash and else case we're throwing some errors in in the case that we are in a simulator and things like that okay so this is the util function uh by the way the code for this is going to be available on my
GitHub or you can check it out at code with. my platform um but yeah if you want to copy the code now the context this is totally optional I think it's just an idea that I had creating a notifications context. TSX okay and this notifications context is just to just so that we can access the token anywhere in the application so I'm I'm planning on wrapping the layout or the entry point of the application with this context and here we are just defining the type of the context then we are importing the register for push
notifications utility function that we just created uh we are importing subscription from Expo module score and down here I'm using I'm creating this hook use notification context which basically is just using the notification context that we are creating here otherwise we are throwing an error otherwise we return the context okay then we are defining some properties for the notification provider this is the provider uh this is how it looks basically is a component that is going to take a children as property and then we are setting some state that we want to share through the
applic throughout the application so the Expo push token is the one that I'm most interested in and then I also want to share the notification data so when we get a notification uh from Expo we get some payload like the title description but but sometimes it's very important to access the data that we are receiving in the notification so I'm just adding the notification and once we get a notification everything inside the context is going to be is going to have access to this notification cool and now in this context I'm setting as well the
listeners for receiving and the responses of the notification okay and to set these listeners as you can see here I'm starting this using these two references everything everything is typed that's why we are using this subscription subscription that we imported at the top uh let's see from Expo module score cool so inside this use effect we are calling the register for push notification async and then once we get the token this is our utility function by the way once we get the token we set the token into the state variable here uh this can be
a string or this can be null we set it if we get an error we set the error and that's it now we set in this uh use effect the listeners for so that we start listening when a notification comes right so this is very important as well guys we have two listeners here the first one is going to be add notification received listener so this listener registered by this method will be called whenever a notification is received while the app is running okay so if my app is open or if my app is foregrounded
this I think I I mean this is only if the app is open I think I'm not sure if the app is foregrounded we will get this notification but if the app is open we will get the notification data and everything sometimes you can set the notification to show even if your application is open but most cases um you want you don't want to show the notification if the app is open right but you can do something with the data so this is where you would have your custom logic in this case I'm setting the
notification variable that we defined up here and this notification is going to be passed to the children of this context okay and I'm putting in the console you know we got a notification and then maybe just maybe just so that we have a better understanding we can say um received while the app is running right so let's copy this and let's just change this in here let me just fix this notification receive while the app is running so let's go ahead and hit save now the other important method and it's very important that we understand
the difference of these two listeners because the other one is it's called add notification response received listener response right response in this case so this listener registered by this method will be called whenever a user interacts with a notification so this is very different because sometimes users get notifications and sometimes they just dismiss them or close them but if the user presses the notification or does the user does something with the notific ification you can trigger some logic based on the response and the response is going to contain very similar results as the notification in
this case the response is going to be of type notification response which contains a notification inside of it and this is of type notification as you can see here this is a notification but if you check the response type this is going to be notification response it's just like a notification with an extra field that's why the type changes but it's going to be very similar but as you can see here in this example the response comes um you know you have to say response do notification to access a notification whereas in the previous method
you can simply access the notification directly because this is what you get in here okay in this case you can say response. notification and then the same data now if I I say dot you can see that we get uh extra um extra Fields like user text and action identifier that's the only difference Okay cool so yeah so you can handle the response in here you can do something with this when we're going to see some examples in this in this case but um let's just go ahead and follow the same pattern in this case
um so we can say user interacts with notification let's let's copy this and just paste it here just so that we know what it's going on right finally these um these are the um subscription cleaners we need to check if we have a current subscription then we want to remove it when we um when we you know when we unmount this component or when we unmount this context finally we are just passing the provider with the value that we want to share to the children which is the Expo push token the notification and the error
if we have one cool so that was a lot of information but once we have this uh context we can go ahead and use it in the application so let's go to the layouts which is the entry point of the app and I'll just go ahead and wrap this into my provider so I'll just say notification Provider from the context and let's just wrap this in here hit save and now just like that everything should be able to have access to the push token cool now before we continue we need to set some uh settings
for the notifications right so let's do that in here I'm going to need to import all as notifications from notifications Expo notifications and let's hit save now this is another very important thing uh here is where we Define if we should show the alert even if the app is open and this is the should show the alert as you can see here it's equal to True which means I should be able to see the notification even if I'm inside the application um so you can set this to true or false whatever uh but yeah you
have to set this notification Handler in here so this is the first thing that we need to do now let's go to the index screen which is inside the tabs this is like the home screen and I'll just go ahead and remove everything that we have in here I'll just go ahead and just create a simple tag and I want to use my um I want to use my hook so let's say use notification this is my hook and remember that this is passing the state that contains Expo push token notification and the error okay
and from here of course you can extend but we can say if we have an error maybe just um maybe just return don't do anything can say return an empty tag for example so what I'll do is I'll just create a simple UI by replacing this um I'm actually using the um theme component theme View and theme text that comes with the template so we are just validating if we have an error then we are putting the notification in the console uh once we get it but by the way I think we are already doing
this in the in the context so if I go to the context let me just double check when we get the notification listener uh but yeah by the way because we're passing the state we're grabbing the state here right so if we get a notification we can use it to display it anywhere in in any component has access to this right just by using this hook so yeah this is what we're doing here so let's go ahead and hit save and I'll just delete this um that I was playing around with um I'm setting here
the response. content data which is the important part of the notifications I would say and let's just hit save and now we need to build our application so that we can test it I'm going to be using EAS because we already have our credentials for IOS and Android over there so let's go ahead and open the terminal and I'll just say EAS build um and then we can specify the profile the profile is going to be development so let's go ahead and hit enter this is going to ask me which platforms Do you want to
build this app for so I'll just say all and uh you want to build a development build client for this application and because I want to install this on my physical device the CLI is very smart and it's telling me that we need to install the Expo def client so let's go ahead and install install that dependency by saying yes and this is going to install it and then it's going to trigger the uh build so as you can see here A bunch of things are happening at the same time we are using the remote
Android credentials that we uploaded before and then we are using the key store from the configuration okay so this is the the credentials and then we are uploading the code that we have in this project to EAS and like I said before because I have a um EAS ignore file um successfully sending these Google services Json right now the same thing for iOS we're using the remote iOS credentials and it's asking me if I want to log to my Apple credentials now this is going to handle everything from Apple in this case so let's go
ahead and sign in to my Apple developer account this is my Apple ID and then I already in I already had my password in here so it's asking me which theme do I want to use in this case I want to use code with Betto my organization and it's logining with my credentials and it's asking me if I want to use the same distribute certificate of course I want to use the same one I don't want to be creating a bunch of certificates but if you don't have a certificate uh just go ahead and create
one so let's go ahead and hit enter and it's asking me about my devices I have two test devices in this case my iPhone 15 Pro and then I also have an iPhone 12 so these two are selected I'll just hit enter and this is creating my new profile for this application would you like to set up push notifications for your project of course we have we want to do that so let's go ahead and hit yes and then let's use the same key that I have but of course if you don't have a key
uh you can create a new one so I'll just go ahead and say yes in this case and if you already have one I would uh I would say just use the same one now this is waiting for the bills to complete and you can press contrl C to exits so yeah we can just leave the terminal open to see the progress of these two builds but yeah let's wait a moment okay so one thing that I'll do while this is loading I'll just put this to the left and I'll bring my iOS device and
just to show you guys that I'm going to delete the app that I had before okay and I want to do the same on Android so let's go ahead and say app info and this is what I like about Android is that you can control the real device throughout this um you know as you can see here I don't know if you can see there but you can um basically delete the application and control my real device from Android Studio which is huge so I'll just go ahead and uninstall click okay just so that we
um we start together once we have these builds all right guys so the builds are ready and if I make these bigger as you can see here by the way I'll make this a bit smaller just so that we can see what's going on here I'll move them to the right but um this is the link for Android and this is the link for iOS so what I can do here is maybe just put this to the left and then bring my iOS device and what I'll do is just copy this link for iOS and
in my device in my device I'll just go to Safari and I'll create a new tab and paste this link in here and click go this is going to take me to the dashboard uh of this specific build as you can see here in my device this is the internal distribution for for iOS and I can click on install this is going to ask me how to this is going to tell me how to install on iOS 16 or higher so let's go ahead and hit continue sorry confirm and now because this is my device
that I already registered um I can go ahead and install this build by saying installed and this is going to install the application here so let me bring this to the cleaner screen that I have here and let's go ahead and open this app by the way uh I forgot I think the server is not running on the left oh it is asking me if I want to run this on uh the Android build on I don't know if this is going to grab my Android that I have connected here but let's just go ahead
and say yes let's try it okay but what I wanted to say is that we don't have the server running so let's say p and PM um start this is going to start the server and we should be able to see that this is a development build as you can see here so let me make this bigger because it's hard to see maybe maybe make this a bit bigger and move this a bit here because my face is covering these two Okay cool so now on the left well on the right we have the development
server running that's one thing that we need to make sure we're doing and then on the left is asking me if I want to install it's asking me which device I want to install yeah so I I think I'll just go ahead and cancel this because I don't see my pixel 8 so I'll just cancel this process and yeah let's come back this in to this in a moment let's put this to the left and then let's go back to the iOS device now in this case I don't see anything even though I have this
app installed right so let's go ahead and sign in I mean log in into our account that's why we don't see any anything so I'll say login and then I'll select my account Betto at Expo and close now it's searching for development servers but uh what I'll do is just close this and then go back to the app and now I should be able to see the notifications server I'll just go ahead and select this one and now it's loading the bundle from here on my real device and this is a development build which means
this is basically how the app is going to work in production okay let me move this to the right now as you can see it's asking me if I want to allow this to send me push notifications in the background we don't see any push token yet for this device so let's go ahead and select allow okay once I allow um we can see the push notification that Expo gave gave us from for this specific device and I just press on continue here this is the development client let's close this and on the terminal we
have this in here so let's go back to the tool I just go ahead and replace this token we are not going to be using it anymore and yeah so from here we can say title my title and then body my body and then we have the same data of course this could be more complex right so for example it could be ID um I don't know message ID let's say that you are working on a message application right and you would have a bunch of uh numbers here and then you could have something more
I don't know like name of who sent this message like sender then this would be something like betano and that's it yeah so that's data right for iOS we want a subtitle so hello sub title and then batch count would be one because let's say that this is just a message for Android we can specify the channel ID we can say default if we don't specify anything and yeah so let's go ahead and close the app so that we can see what's going on and now I'll just trigger the notification and if I wait a
second all right and here we have the notification just like that we have the TT subtitle and body cool really cool right now um let's see the console this is our console and as soon as I type on this notification you can see that we did something right we basically um tap on the notification which means we triggered the notification response which means the user interacted with the notification so this event is going to come with the notification as I was mentioning before and also the date and then the request and all the information that
comes with this push notification now keep in mind that the notifications might look a bit different I mean the responses might look a bit different between IOS and Android but it's going to be always the same to access the data um in this case the data is going to come inside the yeah so here we are logging the data actually it's going to come inside the content request content and then we have this data so this is the data that I sent now from here of course you could do something like I don't know fetch
the message or fetch the conversation by message ID or something like that um and the the we're accessing this by in the index screen uh sorry no this is and this is coming from the uh context so in this case this is a response this is what we are seeing in the console but we are accessing as well the content do data and this is what we're seeing at the very bottom bottom here by the way I don't know if you guys are seeing let me make this a bit bigger um but yeah this is
basically how it looks so it's working for iOS let's go ahead and test this on Android so what I'll do for Android is just go to my Expo dashboard and I'll scroll down and select notifications tutorial which is the app that we are working on and then we can select the Android which is the second one right and as you can see we have the date uh this was what like 20 minutes ago so let's go ahead and select this one and we can install this artifact so this is an APK let's go ahead and
hit install and this is downloading so let's see the details in here now I had the previous version so let's go ahead and delete that one we don't need it anymore and then once this is done I can just go ahead and press now by the way I have the um debugging and developer mode already enabled in this device so make sure that you already have that as well and now it's asking me if I want to open of course I want to open and this is installing it so the app is installed let's go
ahead and open now let's check the terminal by the way because this is going to um give us the information that we need let me make this a bit bigger I'll just go ahead and just close the other terminal we don't need it anymore and I'll just clean this terminal as well cool now the same thing we are not seeing anything because we haven't logged in so let's go ahead and log in select my account Betto at Expo then close this and then we should be able to um you know see this maybe I can
no I cannot shake it so let's go ahead and just close this and open again now that we are authenticated we should be able to see the notifications tutorial and now it's uh running running the uh entry so this should be quick enough and we should be getting an alert asking us if we want to receive push notifications okay and it's the first thing that we see this is great I'll go ahead and allow and once I allow this we should be able to get a push token yeah there we have it so that's the
uh Expo token so this is for Android let's go ahead and copy this let's go to the um tool in this case we can leave the same stuff in here I'll just change the um you know the push token for Android and yeah we can just go ahead and send a notification now in this case now yeah something very interesting right the app is running as you can see here and the behavior is a bit different because in this case the app um it's showing the notification right so this is my title just now and
my body because we're seeing this because um we said it in the layout right we said should show alert if the app is running we said we say through um but that's why we're seeing it here in my device and also in the index remember that when we get a notification and the app is running we are getting the data so let me just close this we're getting the data and then we're putting uh here a text that is just printing the content. data this is what we're seeing on the left um and yeah so
this is a notification I'm accessing the data from here you can do whatever you need and by the way I'm accessing this data um without typing the notification right so this is just one event one listener I was in the app I got the notification and I got the data so you need to handle that according to your business logic but if I go ahead and press on this notification this will be a new event as you can see over there this is the same the same that we were testing on the iOS device and
here we have the same EXA exact output although the um this is going to be a bit different for I Android as you can see this comes with um a very I mean a bit more large body and more properties like sound tag I don't think we have those on iOS and then we also have these weird dot data. body which contains this like stringify body of the payload of the data that we sent but um we also have the content right same as on iOS and inside the content we have the data very well
formatted as we send it and this looks very good and this is how you can access the data for both platform forms okay so request content. data is going to be working for both platforms the exact same way cool so I guess that's all I wanted to show you guys it's a really quick video I mean it's not really quick video but I I would say once you have this set up you should be ready to start integrating um the business logic of your application and everything that you need so that's it for this video
I hope you like it I hope you learned something by the way if you want to master react native go to code with. Dev and check out the courses don't forget to subscribe give it a like and leave me a comment if you have any questions and and if you want to and if you want me to create any specific video just let me know in the comments as well and if you have any questions about this topic just let me know in the comments as well otherwise I'll see you in the next one thanks
for watching by