Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How disable firebase analytics for the whole device ( a test device -android & iOS ) in flutter?

Specifically for flutter apps,

One way is to get the device id and then for each analytics call check if it is a test device or not. Is there a better way or function to do this at app level?

What if my test devices keep on changing all the time?

like image 315
heypran Avatar asked Sep 03 '25 15:09

heypran


1 Answers

I think I found a way to make that happen. Of course, you have to do the query about which device it is, depending on how you recognize a test device. Probably via packages like "imei_plugin". We recognize this by the APi the app is connected to.

If you know that the device is a test device, then all you have to do is the following:

FirebaseAnalytics.instance.setAnalyticsCollectionEnabled(false);

or true if you want to enable the collection of data.

like image 83
Jakob Kühne Avatar answered Sep 05 '25 15:09

Jakob Kühne