Delpin Susai Raj Friday 26 July 2019

Xamarin.Forms - Working with Firebase Analytics

In this blog post, you will learn how to implement Firebase Analytics in Xamarin.Forms mobile app.

Introduction

Xamarin.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

  1. Real-time Database
  2. Storage
  3. Notifications
  4. Authentication
  5. 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 :)

69 comments:

  1. Hi Delphin, I am having difficulty using both analytics and authentication in the same xamarin forms solution. Any ideas?

    ReplyDelete
    Replies
    1. Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download Now

      >>>>> 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

      Delete
  2. 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.

    ReplyDelete
  3. I 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

    ReplyDelete
  4. Yes 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

    ReplyDelete
  5. Much 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

    ReplyDelete
  6. I welcomed your work exceptionally thanks Pyramus And Thisbe

    ReplyDelete
  7. Incredible tips and straightforward. This will be exceptionally helpful for me when I get an opportunity to begin my blog. grass fed organic ghee

    ReplyDelete
  8. Hi, do you know does it support UWP?

    ReplyDelete
  9. Incredible tips and straightforward. This will be exceptionally helpful for me when I get an opportunity to begin my blog.Mobile Price in Bangladesh

    ReplyDelete
  10. Friends, if you have any android file then use this file;

    Files Converter Online

    ReplyDelete
  11. 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

    ReplyDelete
  12. Consummate 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

    ReplyDelete
  13. The 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

    ReplyDelete
  14. Thank you very much for this useful article. I like it. Grass fed ghee

    ReplyDelete
  15. Howdy 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

    ReplyDelete
  16. This 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

    ReplyDelete
  17. Much 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

    ReplyDelete
  18. Is 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.

    ReplyDelete
  19. I 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

    ReplyDelete
  20. It proved to be Very helpful to me and I am sure to all the commentators here! cultured organic ghee

    ReplyDelete
  21. Thanks for sharing this informative content , Great work
    Scrum Master Certification online

    ReplyDelete
  22. 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

    ReplyDelete
  23. Your website is really cool and this is a great inspiring article. organic cultured ghee

    ReplyDelete
  24. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    CSM online certification

    ReplyDelete
  25. I have browsed most of your posts. This post is probably where I got the most useful information for my research. Private Label

    ReplyDelete
  26. I am loving it!! Will return once more. I'm taking your sustenance in addition.Thanks for sharing this information. best coffee beans
    decaf coffee beans
    organic coffee beans

    ReplyDelete
  27. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Coaching agile transitions during this lockdown period everyone can use it wisely.
    Coaching agile transitions

    ReplyDelete
  28. 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

    ReplyDelete
  29. I 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

    ReplyDelete
  30. Wow! 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

    ReplyDelete
  31. I'm taking your sustenance in addition.Thanks for sharing this information. I really like your blog post very much Mobile Phone Repair Preston

    ReplyDelete
  32. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
    icp-cat training

    ReplyDelete
  33. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Coaching agile transitions during this lockdown period everyone can use it wisely.Mobile Phones Bangladesh

    ReplyDelete
  34. 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

    ReplyDelete
  35. It's my first visit to your blog, and I have found it so useful and informative especially this Makeup Artist Wollongong
    Formal Makeup Wollongong
    Wedding Makeup Wollongong
    most trending news

    ReplyDelete
  36. Thanks for sharing this informative content , Great work
    Devops Online Training
    Leanpitch provides online training in Devops during this lockdown period everyone can use it wisely.

    ReplyDelete
  37. 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

    ReplyDelete
  38. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Devops Online Training during this lockdown period everyone can use it wisely.
    Devops Online Training

    ReplyDelete
  39. 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

    ReplyDelete
  40. This is an awesome motivating article.I am practically satisfied with your great work.You put truly extremely supportive data. Keep it up. financing

    ReplyDelete
  41. You have explained the topic very nice. Thanks for sharing a nice article.Visit Nice Java Tutorials

    ReplyDelete
  42. Thanks 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

    ReplyDelete
  43. You 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

    ReplyDelete
  44. 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! global lending services

    ReplyDelete
  45. I had the amazing opportunity to be part of an Ignite session Write For Us Application Development

    ReplyDelete
  46. First of Thanks for the sample code it really useful for me, Please provide a sample for firebase crashylitics.

    ReplyDelete
  47. 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...
    Mobilink jazz whatsapp package 5000 MBs and 12000 SMS only Rs 70 all information and subscribe, status and check Code...
    newsonhy
    newsonhy
    pk packages

    ReplyDelete
  48. 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

    ReplyDelete
  49. Among the many things that a lot of people love to indulge in, Singapore Workpass Application

    ReplyDelete
  50. Great content blogs… must visit this website once. surf jobs

    ReplyDelete
  51. Wow, 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

    ReplyDelete
  52. I 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

    ReplyDelete
  53. Its a great pleasure to see your post and i love your this blog thanks for shearing.... PSL 2020 Schedule

    ReplyDelete
  54. Steam is the ultimate
    destination for playing, discussing, and creating games. yaga


    ReplyDelete
  55. Xamarin Monkeys: Xamarin.Forms - Working With Firebase Analytics >>>>> Download Now

    >>>>> 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

    ReplyDelete
  56. Pacman Online Great information. Very informative blog that you have shared with us.

    ReplyDelete
  57. Ikuti situs judi online dan menangkan grand price menarik lainnya
    link alteratif dewa poker online
    domino88 slot

    ReplyDelete