Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add an android test device to Firebase?

I am integrating Firebase analytics in my android app but I cant see in documentation or google how I can add a test device so It doesn't count on stats.

I test a lot, so my main stats will be corrupted if it counts my own events

In admob I do

 AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("70A9E11F73EREFF712A1B73AE2BC2945")
            .addTestDevice("1D18F0345E4C90E3625DB344BE64D02E")
            .build();
like image 1000
D4rWiNS Avatar asked Jul 28 '16 08:07

D4rWiNS


People also ask

How do I connect my Android app to Firebase?

Open the Firebase Assistant: Tools > Firebase. In the Assistant pane, choose a Firebase product to add to your app. Expand its section, then click the tutorial link (for example, Analytics > Log an Analytics event). Click Connect to Firebase to connect your Android project with Firebase.


2 Answers

You can add device with adb command:

adb shell setprop debug.firebase.analytics.app packageName
like image 136
yozhik Avatar answered Oct 01 '22 10:10

yozhik


I solved it with a new audience in Firebase Console with filter:
User Properties / App Store + "does not contain" + "manual_install"

I figured it out that all direct app installs and also all Firebase Test Lab installs falls into this parameter.

If you want to remove only a few users then you could add this filter (haven't tried it):
User Properties / User ID + "not equal to" (or "does not contain") + your_ID

This only works in Firebase Analytics and only with events that happened after audience was created.


For BigQuery I use the following query to exclude the testing devices:

SELECT
  user_dim.user_id                                      AS userId,
  FORMAT_UTC_USEC(user_dim.first_open_timestamp_micros) AS tsFirstOpen,
  user_dim.device_info.device_category                  AS dCaterogy,
  user_dim.device_info.mobile_brand_name                AS dBrand,
  user_dim.device_info.device_model                     AS dModel2,
  user_dim.device_info.platform_version                 AS dOSver,
  user_dim.device_info.user_default_language            AS dDefLanguage,
  user_dim.geo_info.continent                           AS geoCont,
  user_dim.geo_info.country                             AS geoCounty,
  user_dim.app_info.app_version                         AS appVer,

FROM 
  TABLE_DATE_RANGE(YOUR_TABLE_NAME.app_events_, TIMESTAMP('2016-06-23'), TIMESTAMP('2016-10-01'))
WHERE
// Remove all testing devices
  NOT (user_dim.user_id == "YOUR_USER_ID" OR 
       user_dim.user_id == "YOUR_USER_ID") AND
  NOT user_dim.app_info.app_store == "manual_install"  AND
  user_dim.user_properties.key == "first_open_time"

GROUP BY
  tsFirstOpen,
  userId,
  dCaterogy,
  dBrand,
  dModel2,
  dOSver,
  dDefLanguage,
  geoCont,
  geoCounty,
  appVer
ORDER BY
  appVer DESC,
  tsFirstOpen DESC
like image 43
Blaž Grah Avatar answered Oct 01 '22 11:10

Blaž Grah