dimanche 4 décembre 2016

How to stop Firebase Analytics counting during development and testing of the app?

I am sure that Firebase is counting all my development work too in its analytics. I open my app like hundred times a day to debug and test on a few devices, it's really skewing up my readings.

I have used a function to get me a somewhat unique ID to represent my devices and ignored all its analytics through code.

public static String getPsuedoID() {
    String m_szDevIDShort = "35" + (Build.BOARD.length() % 10)
    + (Build.BRAND.length() % 10) + (Build.VERSION.SDK_INT % 10)
    + (Build.DEVICE.length() % 10) + (Build.DISPLAY.length() % 10)
    + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10);

    String serial;
    try {
        serial = android.os.Build.class.getField("SERIAL").get(null).toString();
        return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
    } catch (Exception exception) {
        serial = "getUniquePsuedoIDfailed";
    }
    return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
}

But I just figured out it is not as unique as I assumed. Apparently, my ID was same as around 2% of total users.

Is there a foolproof method to do just this?

Aucun commentaire:

Enregistrer un commentaire