Firebase Google Analytics Issue

Bhuwan 881 Reputation points
2022-10-02T04:18:32.94+00:00

Hi

i am getting below issue when logging firebase google analytics.

246716-image.png

246722-image.png

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2022-10-04T02:42:09.973+00:00

    Hello @Bhuwan ,

    The error means that the method cannot be called in Main/UI thread, you could try to run the code on another thread by Task.Run Method :

    Task.Run( () => {  
    ...  
    }  
    

    In addition, you could try to use Xamarin.Essentials and determine if code is running on the Main Thread:

    if (MainThread.IsMainThread)  
    {  
        // Code to run if this is the main thread  
    }  
    else  
    {  
        // Code to run if this is a secondary thread  
    }  
    

    Best Regards,
    Wenyan Zhang


    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.