如何防止Play商店测试影响Firebase Analytics [英] How to prevent Play Store testing from affecting Firebase Analytics
问题描述
我刚刚推出了一款新应用,并且正在使用Firebase Analytics。
但是,每当我将新版本上传到Play商店,它都会由Google在11台设备上自动进行测试。哪个好!
-
有没有办法阻止这些测试影响分析?
我从一个小的用户群开始,所以它可以大大地影响它。 我还创建了一个匿名身份验证。有没有办法来防止
为这些预发布测试创建匿名帐户?我可以通过
标识它们,以便在Firebase上将它们删除吗?
经过大量的研究,试验和错误之后,我发现了一些终于有效的东西。我在我的MainActicity(启动活动)中的onCreat()开头添加了这个代码。我希望能帮助别人!
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
String testLabSetting =
Settings.System.getString(getContentResolver(),firebase.test.lab);
if(true.equals(testLabSetting)){
//您正在运行测试实验室
mFirebaseAnalytics.setAnalyticsCollectionEnabled(false); //停用Analytics集合
Toast.makeText(getApplicationContext(),停用Analytics集合,Toast.LENGTH_LONG).show();
}
I just launched a new app and I am using Firebase Analytics. However, every time I upload a new release to the play store, it is automatically tested by Google on 11 devices. Which is great!
Is there a way to prevent those tests from impacting the analytics? I am starting with a small user base, so it can affect it greatly.
I also created an anonymous Auth. Is there a way to prevent it from creating anonymous accounts for those pre-release tests? Can I identify them so I can delete them on Firebase?
After lots of research, trials and error, I found something that finally works. I added this code at the beginning of onCreat() in my MainActicity (launch activity). I hope that helps others!
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
String testLabSetting =
Settings.System.getString(getContentResolver(), "firebase.test.lab");
if ("true".equals(testLabSetting)) {
//You are running in Test Lab
mFirebaseAnalytics.setAnalyticsCollectionEnabled(false); //Disable Analytics Collection
Toast.makeText(getApplicationContext(), "Disabling Analytics Collection ", Toast.LENGTH_LONG).show();
}
Reference code in Firebase docs
这篇关于如何防止Play商店测试影响Firebase Analytics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!