Send Push Notification Using Firebase Admin SDK (.NET MAUI)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my channel in this video I am going to show you demo about sending two certification using Firebase admin SDK in my recent video I just shown you demo about implementing post notification for the Android and iOS platform so in that I am using this Legacy version code to sending post notification so if I click here it just sending notification but I am using this Legacy version URL so we need to use this we need to migrate from HTTP to http version one for this ending post notification so before like in my this code I am using this URL so instead of that we need to use like authorization token to send post notification so if we use a admin SDK then that this Library automatically going to handle the token but like if we don't use this admin SDK then we need to manually request for the token and that token we need to pass in authorization barrier and after that it's just going to send the course notification so let's install this admin SDK in our project okay so just right click on your project and click on manage nuget packages to install Firebase admin SDK so here just search for Firebase admin application and install that finger project okay once it installed here now instead of Legacy code I am just going to write parvis admin SDK code so before that let me just uh download uh that to admin SDK Json support that here in a Firebase console uh just click on Project setting and then click on service account so from here you can just generate the private key and that private key Json I already downloaded so that direction you can add here in a project resources remove folder so let me attach Json so this admin SDK I'm just going to add here in this new folder and after that you can just read that Json file here so let me add code related to editing Json files so I'm just going to use open app package file async and in that I can just add this file name Administration with the extension so it's just going to read the content of this file okay so this just going to repeat admin SDK and this admin SDK we can just uh pass to initialize by which administic acid support that I'm just going to check by if carbon messaging dot different instance is now then of the screen [Music] uh bits here in a credential I'm just going to pass immigration format so like that way this is going to initialize this part by processing instance so when this page is open like initialize that time I'm just going to call this completed okay and here on a counter click I'm just going to now comment this code and new code I'm just going to add here for sending those notification okay so here I can use now Firebase messaging dot default instant dot send a sync or send all the sync method so here send a scene I can send a notification to single device token and using send all the sync I can send notification to multiple device to come so let me just you send a thing and here I just need to pass message object so let me create one object of type message and here I can pass token then notification in that title and message body and here in data if you want to pass some custom data then you can just pass it here now this object I'm just going to pass here inside a single pattern now let me run the application and let's see it's sending notification to this device token order okay so here on the click of counter attack which is calling average messaging dot scientisting method and here notification also will received so using send Using matter I'm just going to send notification to single device token but if you want to send notification to multiple device then you can just use send all the same matter and here you just need to create message list object uh message type and this fill that object list of object like this way so like if you store all the device token in a server side then you just need to call Web API that is going to uh has the list of device token and just use for each Loop and just fill that notification detail like title body then if you want to pass custom data and here here you can just pass the custom data and also like for the iOS if you want to uh just display some batch count and some sound related configuration then you can just use here APNs and mean that you just need to CL like badge calculator whatever the batch count you want to display then some custom data so if you want to pass custom data here in this EP and EPS object and you can pass here so here in custom data I just need to pass string and object for my data so here I just created Android notification object of types things like dictionary type string and string so instead of that I'll just do it going to create another iOS notification object and that's just going to be here it is X tab except string and object format data so here I just passing and up there okay so this is notification of then I can pass here in custom data and here now I can use this message list in sandal missing button notification to the single device because I decided one message object so if you have multiple device token then you can just fill that in message list and just send policy matter and one more thing like this sand order sync method and then I send notification to 500 device token so if you want to send notification to more than 500 then you just need to either use four is low or some background service like a percent 500 and next time again send 500 to open like that way you need to handle okay so on the click on click new button now that notification also is using all the same matters okay so that's all for today I hope you like this video and thank you so much for watching
Info
Channel: Programming With Pragnesh
Views: 4,861
Rating: undefined out of 5
Keywords: .NET MAUI Push Notification, Firebase Admin SDK In .NET MAUI, Firebase Admin Sdk, .NET MAUI Firebase Admin Sdk, .net maui, net maui, maui c#, maui tutorial, maui .net, maui, C# maui, dotnet maui tutorial, blazor tutorial, blazor crud, .net maui app
Id: rhGM0jxraA8
Channel Id: undefined
Length: 10min 3sec (603 seconds)
Published: Sat Apr 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.