Reputation: 665
Firebase Analytics tracks a number of default events: https://support.google.com/firebase/answer/6317485
Some of them like
are BroadcastIntents that don't get sent to the affected package. ACTION_PACKAGE_FIRST_LAUNCH is for example only sent to the installer package, not to the package being installed (source).
How does Firebase Analytics still manage to track these events? What's their method?
Upvotes: 3
Views: 4858
Reputation: 5767
first_open
and app_update
are base on data stored on disk. Each time Firebase Analytics start it reads stored state on disk and checks if this is the first time the app runs. If that's the case first_open
event is recorded and the state on disk is updated. app_upgrade
works similarly. When Firebase Analytics starts is check the version of the app when it last have seen it running. If the version differs it logs app_update
event and updates the state on disk. Where the state on disk is kept differs between devices with and without Google Play Services. On devices with the service the state is saved within Google Play Services data. On non-Google Play devices the data is saved with the app.
app_clear_data
and app_remove
work only on devices with Google Play Services (most Android devices). The Firebase Service that record the state on disk runs inside Google Play Services so when the app runs there is code in the app that tells the Google Play Services if its shared preference file stored in the app data was deleted. Google Play Services then check if this app has run in the past and if it has run it then assumes the app data was cleared and logs app_clear_data
.
For app_remove
there is broadcast from Package Manager when a package is removed. Google Play Services listens to this broadcast and when it receives it app_remove
event is recorded and all data related to this app is removed from the device.
Upvotes: 6