To start using the Firebase Installations package within your project, import it at the top of your project files:
Before using Firebase Installations, you must first have ensured you have initialized FlutterFire.
To create a new Installations instance, call the
instance getter on
By default, this allows you to interact with Installations using the default Firebase App used whilst installing
FlutterFire on your platform. If however you'd like to use a secondary Firebase App, use the
Data tied to a Firebase installation is generally not personally identifying. Still, it can be helpful to give users an option to manage and delete this data.
Firebase installation IDs are different for every installation of every application; different applications on the same device have different Firebase installation IDs. Firebase installation IDs identify app installations and data tied to those app installations.
When you delete an installation ID, the data tied to that installation ID is removed from live and backup systems of all Firebase services that use Firebase installation IDs to identify installations within 180 days. This process is described at a high level in Google’s statement on deletion and retention.
Unless you disable all FID-generating services in your app, FIS creates a new ID within a few days. Firebase considers the newly-created ID to be a new Firebase installation, and doesn't associate it with the previous ID or data in any way.
To delete an FID, call the
delete method on the
If you have a requirement to identify particular installations of your app, you can do so by retrieving the Firebase installation ID. For example, to perform testing during Firebase In-App Messaging development, you can identify and target the correct test device using its Firebase installation ID.
To get the Firebase installation ID, call the
getId method on the
Firebase services can authenticate Firebase installations with auth tokens retrieved from FIS. For example, when designing A/B tests for Remote Config, you can authenticate a targeted test device using an installation auth token.
An installation auth token is a short-lived bearer token in JSON web token (JWT) format containing the following information for an installation:
- The Firebase installation ID
- The associated project (
- The associated Firebase application ID (
- The token's expiration date
An installation auth token cannot be revoked, and remains valid until its expiration date. The default token lifetime is one week.
To retrieve an installation auth token:
Optionally, you can force a token refresh when called:
During the normal operation of an app, Firebase installation IDs (FIDs) don't require special monitoring. However, apps that explicitly retrieve and use FIDs should add logic to monitor the potential deletion or rotation of the FID. Here are some cases where FIDs could be deleted or rotated:
- Uninstallation or re-installation of the app, for instance when an end user installs on a new device.
- The end user clears the cache of the app or the device.
- FID deletion is triggered in the backend due to app inactivity (currently the threshold for this is 270 days of inactivity).
When apps experience a FID rotation or deletion in these kinds of cases, they are assigned a new FID. Also, the installation auth token associated with a deleted FID is deleted, regardless of its own maturity, and is replaced with a new installation auth token.
Apps can monitor these changes and respond accordingly.
To monitor the FID token, listen to the
Stream returned from the