How to integrate Firebase Analytics in .NET MAUI.

Bhuwan 636 Reputation points
2024-01-10T14:53:47.1333333+00:00

How to integrate Firebase Analytics in .NET MAUI.

for previous Xamarin application follow this URL and it's working both android and iOS devices and log proper data - https://thewissen.io/using-firebase-analytics-in-your-xamarin-forms-app/

but in MAUI suggested Firebase integration URL - https://dev.to/vhugogarcia/firebase-analytics-in-net-maui-4p6d

i am trying above MAUI but it's not working and getting lots of issue like google-services.json and set build action to GoogleServicesJson. for android GoogleServicesJson build action not exists.

please can you suggest me proper solution or any URL which i follow for upgrade google analytics Xamarin to MAUI project and deliver.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 39,391 Reputation points Microsoft Vendor
    2024-01-12T02:59:43.19+00:00

    Hello,

    Firebase-related libraries have been migrated to .Net and support MAUI.

    The following is Firebase Analytics Nugets:

    For more information on how to use these packages, you could refer to the following official documentation.

    Update:

    This caused by a path length of more than 260 characters. Visual Studio does not support Nuget long paths. Please refer to Long Path Support for more details.  

    Visual Studio or msbuild -t:restore does not yet support long paths.

    You could refer to a similar issue in Maui - iOS push notification cannot be set up - Could not find a part of the path (Path too long) #630 and use the workarounds from it. Workaround 1.

    Try clearing your local nuget cache and run a nuget restore from the command line (not using Visual Studio).

    Workaround 2.

    I fixed this by changing the nuget package location to a path that’s shorter than the default path. I did this by adding the following configuration to my NuGet.Config.<config> <add key="globalPackagesFolder" value="D:\nuget" /> </config>

    NuGet.Config is not an intra-project configuration file, but a global configuration file for NuGet. Usually, it exists in the C:\Users\YouUser\AppData\Roaming\NuGet folder.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful