इंस्टेंस आईडी एपीआई
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इंस्टेंस आईडी एपीआई की मदद से, इंस्टेंस आईडी को अपने Android या iOS ऐप्लिकेशन के साथ इंटिग्रेट किया जा सकता है. इंस्टेंस आईडी, आपके ऐप्लिकेशन के हर इंस्टेंस के लिए एक यूनीक आइडेंटिफ़ायर उपलब्ध कराता है. साथ ही, कार्रवाइयों की पुष्टि करने और उन्हें अनुमति देने का तरीका भी उपलब्ध कराता है. InstanceID
का इस्तेमाल लंबे समय तक किया जा सकता है. हालांकि, इन वजहों से इसकी समयसीमा खत्म हो सकती है:
- डिवाइस को फ़ैक्ट्री रीसेट करना.
- उपयोगकर्ता ऐप्लिकेशन को अनइंस्टॉल कर देता है.
- उपयोगकर्ता, ऐप्लिकेशन में “डेटा मिटाएं” सुविधा का इस्तेमाल करता है.
- डिवाइस का लंबे समय तक इस्तेमाल न किया गया हो. डिवाइस और इलाके के हिसाब से, टाइमसीमा तय की जाती है.
- इंस्टेंस आईडी सेवा, गलत इस्तेमाल या गड़बड़ियों का पता लगाती है और
InstanceID
को रीसेट करती है.
- अगर आपके क्लाइंट ऐप्लिकेशन को इस सुविधा की ज़रूरत है, तो सर्वर-साइड कोड.
इंस्टेंस आईडी सेवा, InstanceIDListenerService
के कॉलबैक के ज़रिए आपके ऐप्लिकेशन को InstanceID
रीसेट करने की सूचना देती है. अगर आपके ऐप्लिकेशन को यह सूचना मिलती है, तो उसे getToken()
को कॉल करके नया InstanceID
पाना होगा और अपने सर्वर अपडेट करने होंगे.
InstanceID
के मालिकाना हक की पुष्टि करने और ऐप्लिकेशन से जुड़े डेटा या सेवाओं को ऐक्सेस करने के लिए, getToken
तरीके का इस्तेमाल करें. यह तरीका, OAuth2 के पैटर्न का पालन करता है. इसके लिए, authorizedEntity
और scope
की ज़रूरत होती है. authorizedEntity
, प्रोजेक्ट आईडी या कोई दूसरा InstanceID
हो सकता है. इससे यह तय होता है कि जनरेट किए गए टोकन का इस्तेमाल किन सेवाओं को करना है. scope
से यह तय होता है कि टोकन किस सेवा या डेटा को ऐक्सेस करने की अनुमति देता है.
इनके लिए, इंस्टेंस आईडी एपीआई के बारे में ज़्यादा जानें:
Android
iOS
सर्वर
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThe Instance ID API provides a unique identifier for each app instance and enables authentication and authorization.\u003c/p\u003e\n"],["\u003cp\u003eInstance IDs are long-lived but can expire due to various factors like device reset, uninstallation, data clearing, extended inactivity, or service-detected issues.\u003c/p\u003e\n"],["\u003cp\u003eUpon Instance ID reset, apps are notified and must retrieve a new ID using \u003ccode\u003egetToken()\u003c/code\u003e and update their servers.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetToken()\u003c/code\u003e method, using OAuth2 patterns, verifies Instance ID ownership and grants server access to associated data or services based on authorized entity and scope.\u003c/p\u003e\n"]]],[],null,["# Instance ID API\n\nThe Instance ID API lets you integrate Instance ID with your Android\nor iOS app. Instance ID provides a unique identifier for each instance of\nyour app and a mechanism to authenticate and authorize actions. The `InstanceID` is long\nlived, but may expire for the following reasons:\n\n- Device factory reset.\n- User uninstalls the app.\n- User performs \"Clear Data\" in the app.\n- Device unused for an extended period (device and region determines the timespan).\n- Instance ID service detects abuse or errors and resets the `InstanceID`.\n- Server-side code if your client app requires that functionality.\n\nThe Instance ID service notifies your app of an `InstanceID` reset via\ncallback to a `InstanceIDListenerService`. If your app receives this\nnotification, it must call `getToken()` and retrieve the new `InstanceID`,\nand update its servers.\n\nUse the `getToken` method to prove the ownership of the `InstanceID` and to allow\nservers to access data or services associated with the app. The method follows\nthe patterns of OAuth2, and requires an `authorizedEntity` and `scope`. The\n`authorizedEntity` can be a project ID or another `InstanceID`, and it determines\nthe services that are authorized to use the generated token. The `scope`\ndetermines the specific service or data to which the token allows access.\n\nLearn more about the Instance ID API for:\n\n[Android](/instance-id/reference/android/api)\n[iOS](/instance-id/reference/ios/api)\n[Server](/instance-id/reference/server)"]]