Alex McLean
Alex McLean

Reputation: 2764

Enabling Debug Mode for Firebase Analytics for Flutter

I want to test receiving Firebase Analytics events on my development device. The documentation here says you need to do this by adding a command line argument to Xcode.

To enable Analytics Debug mode on your development device, specify the following command line argument in Xcode :

-FIRDebugEnabled

How are you supposed to do this for Flutter? When you're using it through VS Code or via flutter run?

Update

I tried following the answer here but to no avail. I think Flutter uses Xcode build, so perhaps it makes sense that adding the params to the run scheme doesn't work with flutter?

I also tried setting IS_ANALYTICS_ENABLED to true in GoogleService-Info.plist, but also didn't seem to work.

Update 2

I've gotten the events to now show up in the Debug Events Console on Firebase, but only if I launch the app from Xcode. If I do so from Flutter it still wont send the events (which is what I'm trying to accomplish).

Upvotes: 29

Views: 14164

Answers (3)

Rubiya Faniband
Rubiya Faniband

Reputation: 370

Open Xcode

  1. SelctProduct->Scheme > Edit scheme
  2. Select Run from the left menu.
  3. Select the Arguments tab.
  4. In the Arguments Passed On Launch section, add -FIRAnalyticsDebugEnabled.

Answered at Turning Firebase Analytics on on Xcode for greater visibility added the link and answer both, Credit should the owner of this answer @checklist.

PS: Currently (oct-23) on Firebase oficial documentation indicate that the command to add is -FIRDebugEnabled instead -FIRAnalyticsDebugEnabled. Test what works for you

Upvotes: 17

Tom Bailey
Tom Bailey

Reputation: 702

I think you might need to use Flutter flavors to pass the FIRDebugEnabled flag when you start the app with flutter run instead of through XCode. Please see https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36

Upvotes: 3

Marcel Dz
Marcel Dz

Reputation: 2714

You can put the Events as ouptut in NSLOG(..) which is readable by flutter. If you put it in your swift code basically, you can get the ouput in flutter console.

Upvotes: -1

Related Questions