In this blog post, you will learn how to implement Firebase Analytics in Xamarin.Forms mobile app.
IntroductionXamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.
Firebase
Firebase gives you functionality like analytics, databases, messaging and crash reporting so you can move quickly and focus on your users.
Firebase is a back-end platform for building Web, Android, and iOS applications. It offers real-time database, different APIs, multiple authentication types and hosting platform. This is an introductory tutorial, which covers the basics of the Firebase platform and explains how to deal with its various components and sub-components.
Build apps with Firebase
- Real-time Database
- Storage
- Notifications
- Authentication
- Hosting
Firebase Analytics
Google Analytics for Firebase provides free, unlimited reporting on up to 500 distinct events. The SDK automatically captures certain key events and user properties, and you can define your own custom events to measure the things that uniquely matter to your business.
For more
https://firebase.google.com/docs/analytics
Prerequisites
- Visual Studio 2017 or later (Windows or Mac)
- Firebase Account
Setting up a Xamarin.Forms Project
https://github.com/susairajs/XamarinForms_FirebaseAnalytics
Start by creating a new Xamarin.Forms project. You wíll learn more by going through the steps yourself.
Visual Studio 2019 has more options in the opening window. Clone or check out the code from any repository or, open a project or solution for your computer.
Now, you need to click "Create a new project".
Now, filter by Project Type: Mobile
Choose the Mobile App (Xamarin. forms) project under C# and Mobile.
Name your app. You probably want your project and solution to use the same name as your app. Put it on your preferred location for projects and click "Create".
Now, select the blank app and target platforms - Android, iOS and Windows (UWP).
Subsequently, go to the solution. In there, you get all the files and sources of your project (.NET Standard). Now, select the XAML page and double-click to open the MainPage.Xaml page.
You now have a basic Xamarin.Forms app. Click the Play button to try it out.
Setting up the User Interface
Go to MainPage.Xaml and write the following code.
MainPage.xaml
NuGet Package
Now, add the following NuGet package in your .Net Standard Project.
- Xamarin.Firebase.Core
Create a Interface IFirebaseAnalytics
Now, create an Interface in .Net Standard Project.
Write the following code.
IFirebaseAnalytics.cs
Android Implementation
Create a project in Firebase
In this step, create a project in Firebase. Go to the following link.
https://console.firebase.google.com/
Click "Add Project".
Now, give the project a name and select your country. Then, read the terms. Afterward, click "Create project".
Now, your project is ready, click "Continue".
Add Firebase to your Android App
Now Register your android app in firebase with Android package name, app name(optional) and your debuting signing certificate(optional) then click to register app.
Done, now you will get one google-service.json file you should download it.
Now Add google-service.json in your ProjectName.Android Project and set Bundle Action GoogleServicesJson
Add following ItemGroup in your ProjectName.Android.csproj file
NuGet Package
Now, add the following NuGet package in your android project.
- Xamarin.FireBase.Analytics.Impl
Create class FirebaseAnalytics in android project
FirebaseAnalytics.cs
iOS Implementation
Add Firebase to your iOS App
Now Register your iOS app in firebase with iOS Bundle id, app nickname(optional) and App Store id(optional) then click to register app.
Done, now you will get one GoogleService-Info.plist file you should download it.
Now Add GoogleService-Info.plist in your ProjectName.iOS Project and set Bundle Action Bundle Resource
NuGet Package
Now, add the following NuGet package in your iOS project.
- Xamarin.FireBase.iOS.Analytics
Create class FirebaseAnalytics in iOS project
FirebaseAnalytics.cs
Note: Go to Run -> Run With -> Custom Configuration and add the following to Extra mlaunch Arguments:
Finally Add the Click Event in MainPage.xaml.cs
Click the "Play" button to try it out.
Check your app analytics in firebase
Download Full Project From GitHub
https://github.com/susairajs/XamarinForms_FirebaseAnalytics
I hope you have understood how to implement Firebase Analytics in Xamarin.Forms mobile app.
Thanks for reading. Please share your comments and feedback. Happy Coding :)
Hi Delphin, I am having difficulty using both analytics and authentication in the same xamarin forms solution. Any ideas?
ReplyDeleteXamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download Now
Delete>>>>> Download Full
Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download LINK
>>>>> Download Now
Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download Full
>>>>> Download LINK cm
hi Delpin, System.NullReferenceException: 'Object reference not set to an instance of an object.' button click action returns this error, please help out on this.
ReplyDeleteI can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. Blog tracking
ReplyDeleteYes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!! Reunion Island
ReplyDeleteMuch thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more. best organic ghee
ReplyDeleteI welcomed your work exceptionally thanks Pyramus And Thisbe
ReplyDeleteIncredible tips and straightforward. This will be exceptionally helpful for me when I get an opportunity to begin my blog. grass fed organic ghee
ReplyDeleteexcellent your text .mobile price in bangladesh
ReplyDeletecan you review Mobile Mall on your blog
ReplyDeleteHi, do you know does it support UWP?
ReplyDeleteIncredible tips and straightforward. This will be exceptionally helpful for me when I get an opportunity to begin my blog.Mobile Price in Bangladesh
ReplyDeleteFriends, if you have any android file then use this file;
ReplyDeleteFiles Converter Online
That will support these kind of formats;
ReplyDeleteM4v to Jpg
3gp file to Jpeg
3gp to Mp3
3gp to Wav
3gp to Jpeg
This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post. Krushia
ReplyDeleteConsummate case of hypothesis, compassion and expression. Here I took in another approach to theorize through writer's written work. It enabled me to feel another approach to estimate your considerations and express them in a simple and clear way. produttori nocciole biologiche
ReplyDeleteThe profundity of articles can without much of a stretch be felt of this blog. Exceptionally exact and straight to the check. I saw effectively the obvious reality which the creator of this blog needed to convey through his contemplations. Searching for additional. Ecommerce payment app
ReplyDeleteThank you very much for this useful article. I like it. Grass fed ghee
ReplyDeleteHowdy was simply checking whether you minded a remark. i like your site and the thme you picked is super. I will be back. organic grass fed ghee
ReplyDeleteThis blog is truly useful to convey refreshed instructive issues over web which is truly appraisable. I discovered one effective case of this truth through this blog. I will utilize such data now. barbie long dress
ReplyDeleteMuch obliged to you for some other educational web journal. Where else might I be able to get that kind of data written in such a perfect means? I have a mission that I'm a few seconds ago chipping away at, and I have been at the post for such data. What is Ghee
ReplyDeleteIs your washing machine is in repair? Looking for good technicians in your surrounding areas. IFB Washing Machine Repair Center in Hyderabad Please call us on 9133393345 9133393346. Any type of issue we will solve, we provide a service warranty also.
ReplyDeleteI like the valuable info in your articles. I'll bookmark your blog and check again here regularly. I'll learn plenty of new stuff right here! Best of luck for the next! Regards LimeTorrent
ReplyDeleteIt proved to be Very helpful to me and I am sure to all the commentators here! cultured organic ghee
ReplyDeleteThanks for sharing this informative content , Great work
ReplyDeleteScrum Master Certification online
Im no master, however I trust you simply made a fantastic point. You unquestionably completely comprehend what youre talking about, and I can really get behind that. cultured Grass-fed ghee
ReplyDeleteYour website is really cool and this is a great inspiring article. organic cultured ghee
ReplyDeleteThanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
CSM online certification
I have browsed most of your posts. This post is probably where I got the most useful information for my research. Private Label
ReplyDeleteI am loving it!! Will return once more. I'm taking your sustenance in addition.Thanks for sharing this information. best coffee beans
ReplyDeletedecaf coffee beans
organic coffee beans
Thanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Coaching agile transitions during this lockdown period everyone can use it wisely.
Coaching agile transitions
I like this concept. I visited your blog for the first time and became your fan. Keep posting as I am going to read it everyday.thanks for this article
ReplyDeleteI wish more authors of this type of content would take the time you did to research and write so well.I am very impressed with your vision and insight. pongal quotes
ReplyDeleteWow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also. brother quotes
ReplyDeleteI'm taking your sustenance in addition.Thanks for sharing this information. I really like your blog post very much Mobile Phone Repair Preston
ReplyDeleteThanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
icp-cat training
Thanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Coaching agile transitions during this lockdown period everyone can use it wisely.Mobile Phones Bangladesh
I don t have the time at the moment to fully read your site but I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for a great site. internet marketing tips
ReplyDeleteIt's my first visit to your blog, and I have found it so useful and informative especially this Makeup Artist Wollongong
ReplyDeleteFormal Makeup Wollongong
Wedding Makeup Wollongong
most trending news
It's my first visit to your blog, and I have found it so useful and informative especially this Restaurant Perth
ReplyDeleteDegustation Perth
Seafood Restaurant Perth Gifts for plant lover
Propagating Houseplants In Water
How To Propagate Plants
Thanks for sharing this informative content , Great work
ReplyDeleteDevops Online Training
Leanpitch provides online training in Devops during this lockdown period everyone can use it wisely.
I have browsed most of your posts. This post is probably where I got the most useful information for my research. printer ink prices in new york
ReplyDeleteThanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Devops Online Training during this lockdown period everyone can use it wisely.
Devops Online Training
Extraordinary blog. I took pleasure in scrutinizing your articles. This is extremely a marvelous scrutinized for me. I have bookmarked it and I am suspecting examining new articles. Continue doing magnificent! Anniversary Jewelry
ReplyDeleteThis is an awesome motivating article.I am practically satisfied with your great work.You put truly extremely supportive data. Keep it up. financing
ReplyDeleteYou have explained the topic very nice. Thanks for sharing a nice article.Visit Nice Java Tutorials
ReplyDeleteThanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people. Finance Investment Management Company
ReplyDeleteYou have done a great job. I will definitely dig it and personally recommend to my friends. I am confident they will be benefited from this site. Online Clean Eating Book
ReplyDeleteExtraordinary blog. I took pleasure in scrutinizing your articles. This is extremely a marvelous scrutinized for me. I have bookmarked it and I am suspecting examining new articles. Continue doing magnificent! global lending services
ReplyDeleteResolve The Error Of HP Printer Offline Issue
ReplyDeleteResolve The Issue For Laptop is not Charging HP
Guide To Fix The Problem Of Yahoo Mail Not Syncing
I had the amazing opportunity to be part of an Ignite session Write For Us Application Development
ReplyDeleteFirst of Thanks for the sample code it really useful for me, Please provide a sample for firebase crashylitics.
ReplyDeletenice tutorial tech
ReplyDeleteitel mobile price in Bangladesh
Mobilink jazz internet packages 3G/4G Daily, Weekly and Monthly All List and Complete Information. How to Subscribe, Status, MBs, GB check Cods and Price...
ReplyDeleteMobilink jazz whatsapp package 5000 MBs and 12000 SMS only Rs 70 all information and subscribe, status and check Code...
newsonhy
newsonhy
pk packages
It verbalizes a limitless imagination. I am totally impressed with the factual transformation skill of author used for transforming his thoughts and presented here. Impressed with deep meaning of this article. Produttori nocciole biologiche
ReplyDeleteAmong the many things that a lot of people love to indulge in, Singapore Workpass Application
ReplyDeleteGreat content blogs… must visit this website once. surf jobs
ReplyDeleteWow, cool post. I'd like to write like this too taking time and real hard work to make a great article but I put things off too much and never seem to get started. Thanks though. hk com
ReplyDeleteI think this is an informative post and it is very useful and knowledgeable. Really its Great Article .Vendita nocciole biologiche in guscio crude e tostate. Nocciole biologiche in guscio
ReplyDeleteIts a great pleasure to see your post and i love your this blog thanks for shearing.... PSL 2020 Schedule
ReplyDeleteThanks for writing a superb Blog.Guerilla Post
ReplyDeleteSteam is the ultimate
ReplyDeletedestination for playing, discussing, and creating games. yaga
Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download Now
ReplyDelete>>>>> Download Full
Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download LINK
>>>>> Download Now
Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download Full
>>>>> Download LINK cc
Many thanks for the post.
ReplyDeleteTecno Mobile Price in Pakistan
Pacman Online Great information. Very informative blog that you have shared with us.
ReplyDeleteVERY INFORMATIVE Singapore Citizenship
ReplyDeleteLogo Design Many thanks for the post.
ReplyDeleteWrite For Us Technology good when i check
ReplyDeleteIkuti situs judi online dan menangkan grand price menarik lainnya
ReplyDeletelink alteratif dewa poker online
domino88 slot
Thank you for sharing such a great post it is very helpful for us. vtrahe
ReplyDelete