Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Wichtige Features
Neben der Bereitstellung eindeutiger IDs für die Authentifizierung kann die Instanz-ID auch Sicherheitstokens für die Verwendung mit anderen Diensten generieren. Weitere Funktionen:
Sicherheitstokens generieren
Die Instanz-ID bietet eine einfache API zum Generieren von Sicherheitstokens, mit denen Drittanbieter autorisiert werden, auf serverseitig verwaltete Ressourcen Ihrer App zuzugreifen.
App-Authentizität bestätigen
Übergeben Sie Instanz-ID-Tokens an Ihren Server und verwenden Sie den Instanz-ID-Dienst, um den App-Paketnamen zu überprüfen und festzustellen, ob er eine gültige Signatur hat.
Durch die Überprüfung von Tokens mit dem Instance ID Cloud Service können bekannte Apps identifiziert werden. Um Kosten und unnötige Roundtrip-Kommunikation zu reduzieren, konfigurieren Sie Ihren Server so, dass diese Tokens gespeichert werden, damit die Prüfung nur einmal erforderlich ist.
Bei Sicherheitsbedenken kann Ihre App Tokens oder die Instance-ID selbst löschen und neue generieren. Außerdem initiiert der Instance ID-Server die Aktualisierung von Token oder Instance-IDs, wenn er Fehler oder Sicherheitsprobleme erkennt.
Prüfen, ob das App-Gerät aktiv ist
Der Instance-ID-Server kann Ihnen mitteilen, wann das Gerät, auf dem Ihre App installiert ist, zuletzt verwendet wurde. So können Sie entscheiden, ob Sie Daten aus Ihrer App behalten oder eine Push-Benachrichtigung senden möchten, um Nutzer wieder anzusprechen.
Apps identifizieren und verfolgen
Die
-Instanz-ID ist für alle App-Instanzen weltweit eindeutig. Ihre Datenbank kann sie also verwenden, um App-Instanzen eindeutig zu identifizieren und nachzuverfolgen. Ihr serverseitiger Code kann über den Instance ID-Clouddienst prüfen, ob eine Instance ID echt ist und mit der ID der ursprünglichen App übereinstimmt, die bei Ihrem Server registriert wurde. Aus Datenschutzgründen kann Ihre App eine Instanz-ID löschen, damit sie nicht mehr mit dem Verlauf in der Datenbank verknüpft ist. Wenn Ihre App das nächste Mal die Instanz-ID aufruft, erhält sie eine völlig neue Instanz-ID, die in keiner Beziehung zur vorherigen steht.
Lebenszyklus von Instanz-IDs
Der Instance ID-Dienst gibt ein InstanceID aus, wenn Ihre App online geht.
Die InstanceID wird durch ein öffentliches/privates Schlüsselpaar gesichert, wobei der private Schlüssel auf dem lokalen Gerät gespeichert und der öffentliche Schlüssel beim Instance ID-Dienst registriert ist.
Ihre App kann bei Bedarf mit der Methode getID() ein neues InstanceID anfordern. Ihre App kann sie auf Ihrem Server speichern, sofern Sie einen Server haben, der Ihre App unterstützt.
Ihre App kann bei Bedarf mit der Methode getToken() Tokens vom Instanz-ID-Dienst anfordern. Wie bei InstanceID kann Ihre App auch Tokens auf Ihrem eigenen Server speichern. Alle für Ihre App ausgestellten Tokens gehören zum InstanceID der App.
Tokens sind eindeutig und sicher. Ihre App oder der Instance ID-Dienst müssen Tokens jedoch möglicherweise aktualisieren, wenn ein Sicherheitsproblem auftritt oder wenn ein Nutzer Ihre App während der Wiederherstellung des Geräts deinstalliert und neu installiert. Ihre App muss einen Listener implementieren, um auf Tokenaktualisierungsanfragen des Instance ID-Dienstes zu reagieren.
Clientimplementierung
Die Instanz-ID wird sowohl unter Android als auch unter iOS ausgeführt. Für jede Methode müssen Sie die entsprechende Bibliothek in Ihre Client-App einbinden. Für Android ist Google Play-Dienste erforderlich. Wenn Sie Tokens generieren möchten, benötigen Sie eine Projekt-ID, die von der Google Developers Console generiert wurde.
Eine ausführliche Anleitung finden Sie in den Implementierungsleitfäden für Android und iOS.
[null,null,["Zuletzt aktualisiert: 2025-09-05 (UTC)."],[[["\u003cp\u003e\u003cstrong\u003eWarning:\u003c/strong\u003e The Instance ID API is deprecated; for unique app installation identifiers, use the Firebase installations API instead.\u003c/p\u003e\n"],["\u003cp\u003eInstance ID offers key features like generating security tokens, verifying app authenticity, confirming app device activity, and identifying/tracking apps.\u003c/p\u003e\n"],["\u003cp\u003eInstance ID has a lifecycle involving issuing an ID, requesting fresh IDs and tokens, storing them on the server (optional), and handling token refreshes.\u003c/p\u003e\n"],["\u003cp\u003eClient implementation requires including the appropriate library and potentially a Project ID for token generation.\u003c/p\u003e\n"],["\u003cp\u003eFor detailed instructions, refer to the Android and iOS implementation guides.\u003c/p\u003e\n"]]],[],null,["# What is Instance ID?\n\n| **Warning:** The Instance ID API is deprecated. If you need to access unique app installation identifiers, use the [Firebase installations](//firebase.google.com/docs/projects/manage-installations) API. See also [Firebase installations and Instance ID](//firebase.google.com/docs/projects/manage-installations#fid-iid). The [server-side topic management API](https://developers.google.com/instance-id/reference/server#create_relationship_maps_for_app_instances) is still available.\n\nKey features\n------------\n\nIn addition to providing unique IDs for authentication, Instance ID\ncan generate security tokens for use with other services. Other features\ninclude:\n\n### Generate Security Tokens\n\n: Instance ID provides a simple API to generate security tokens that\n authorize third parties to access your app's server side managed resources.\n\n### Verify app authenticity\n\n: Pass Instance ID tokens to your server and use the Instance ID\n service to verify the app package name and check if it has a valid signature.\n Verifying tokens with the Instance ID Cloud Service helps identify known\n apps. To reduce cost and redundant round trip communications, configure your\n server to store these tokens so the check is needed only once.\n In the event of a security concern, your app can delete tokens, or\n Instance ID itself, and generate new ones. In addition, the\n Instance ID server initiates token or Instance ID refresh if it\n detects bugs or security issues.\n\n### Confirm app device is active\n\n: The Instance ID server can tell you when the device on which your app\n is installed was last used. Use this to decide whether to keep data from your\n app or send a push message to reengage with your users.\n\n### Identify and track apps\n\n: Instance ID is unique across all app instances across the world, so\n your database can use it to uniquely identify and track app instances. Your\n server-side code can verify, via the Instance ID cloud service, that an\n Instance ID is genuine and is the same ID as the original app that\n registered with your server. For privacy, your app can delete an Instance ID so\n it is no longer associated with any history in the database. The next time your\n app calls Instance ID it will get an entirely new Instance ID with no\n relationship to its previous one.\n\nInstance ID lifecycle\n---------------------\n\n1. The Instance ID service issues an `InstanceID` when your app comes online. The `InstanceID` is backed by a public/private key pair with the private key stored on the local device and the public key registered with the Instance ID service.\n2. Your app can request a fresh `InstanceID` whenever needed using the `getID()` method. Your app can store it on your server if you have one that supports your app.\n3. Your app can request tokens from the Instance ID service as needed using the `getToken()` method, and like `InstanceID`, your app can also store tokens on your own server. All tokens issued to your app belong to the app's `InstanceID`.\n4. Tokens are unique and secure, but your app or the Instance ID service may need to refresh tokens in the event of a security issue or when a user uninstalls and reinstalls your app during device restoration. Your app must implement a listener to respond to token refresh requests from the Instance ID service.\n\nClient implementation\n---------------------\n\nInstance ID runs on both Android and iOS. Each requires you to include\nthe appropriate library in your client app. Android requires\n[Google Play Services](https://developer.android.com/google/play-services/index.html). You will need a Project ID generated\nby the [](/console/help/new)[Google Developers Console](https://console.developers.google.com/project) if you intend\nto generate tokens.\n\nFor detailed instructions, see the [Android](/instance-id/guides/android-implementation)\nand [iOS](/instance-id/guides/ios-implementation) implementation guides."]]