인스턴스 ID는 앱의 개별 설치를 식별합니다. 각 인스턴스 ID가 특정 앱 및 기기별로 고유하므로 이를 통해 Firebase 서비스에서 특정 앱 인스턴스를 참조할 수 있습니다. 예를 들어 Cloud Messaging은 인스턴스 ID를 사용하여 메시지를 보낼 기기를 확인합니다.
여러 Firebase 서비스가 인스턴스 ID를 사용하여 기능을 강화합니다.
Analytics
Crashlytics
Cloud Messaging
Remote Config
인스턴스 ID와 연결된 앱 데이터 관리
인스턴스 ID를 사용하여 설치를 식별하는 서비스는 해당 기기의 관련 데이터를 연결하는 데도 인스턴스 ID를 사용합니다. 예를 들어 Crashlytics는 기기에서 발생한 비정상 종료를 기록하는 데, Remote Config은 구성을 가져오는 데, Analytics는 특정 잠재고객을 추적하는 데 각각 인스턴스 ID를 사용합니다.
인스턴스 ID와 연결된 데이터는 대개 개인 식별 데이터가 아니지만 사용자에게 관리 옵션을 제공하면 유용합니다. 이를 위해 Firebase는 인스턴스 ID 관련 데이터 수집을 관리하는 두 가지 방법을 제공합니다.
인스턴스 ID 삭제: 서버 또는 클라이언트 측 API 호출로 인스턴스 ID를 삭제할 수 있습니다. 인스턴스 ID를 삭제하면 ID 자체와 해당 ID와 연결된 모든 데이터가 삭제됩니다.
ID를 생성하는 서비스 사용 중지: 인스턴스 ID를 사용하는 대부분의 Firebase 서비스는 서비스를 시작할 때 기기에 ID가 없으면 자동으로 새 ID를 생성합니다. 앱에서 원치 않는 인스턴스 ID를 생성하지 않도록 하려면 이러한 서비스의 자동 초기화를 사용 중지합니다.
인스턴스 ID 삭제
인스턴스 ID를 삭제하면 위에 나와 있는 Firebase 서비스에서 해당 ID와 연결된 데이터도 삭제됩니다. 따라서 ID 삭제는 사용자 데이터를 삭제하는 데 유용한 도구이지만 유의할 점도 있습니다. 인스턴스 ID를 활용하는 여러 서비스를 사용하고 있다면 ID 삭제 시 이러한 모든 서비스에서 데이터가 삭제됩니다.
앱에서 인스턴스 ID를 생성하는 모든 서비스를 사용 중지하지 않는 한 인스턴스 ID 서비스가 며칠 안에 새 ID를 만듭니다. Firebase는 새로 만든 ID를 새로운 앱 인스턴스로 간주하며 어떠한 방식으로도 이전 ID와 연결하지 않습니다.
클라이언트 API 호출로 ID 삭제
Firebase 서비스에서 생성한 ID를 삭제하려면 Firebase Instance ID API에서 적절한 메소드를 호출합니다.
// An Instance ID sent from a client service SDKconstidToDelete='INSTANCE_ID';admin.instanceId().deleteInstanceId(idToDelete);
자바
// An Instance ID sent from a client service SDKStringidToDelete="INSTANCE_ID";FirebaseInstanceId.getInstance().deleteInstanceIdAsync(idToDelete).get();
Python
fromfirebase_adminimportinstance_id# An Instance ID sent from a client service SDKid_to_delete='INSTANCE_ID'instance_id.delete_instance_id(id_to_delete)
서버 API 호출로 인스턴스 ID를 삭제하면 Firebase 서비스가 연결된 데이터를 삭제하고 해당 ID에 대한 새로운 데이터를 더 이상 허용하지 않으며 며칠 안에 클라이언트 앱에 ID가 삭제되었다는 알림을 전송합니다. Firebase에서 클라이언트 앱에 알림을 전송하기 전에는 일부 앱 서비스의 기능이 저하될 수 있습니다.
현재 인스턴스 ID를 삭제하고 즉시 새로운 독립 ID로 Firebase 서비스를 사용하려면 위의 클라이언트 API 중 하나를 사용하여 삭제를 처리하세요.
인스턴스 ID 생성 사용 중지
인스턴스 ID를 사용하는 서비스는 현재 ID가 없는 앱에서 초기화될 때 자동으로 새 ID를 생성합니다. 또한 이러한 서비스는 대개 앱을 시작할 때 자동으로 초기화됩니다. 인스턴스 ID 생성을 사용 중지하려면 인스턴스 ID를 사용하는 서비스에서 자동 초기화를 사용 중지해야 합니다.
일반적인 방법은 사용자에게 데이터 수집을 선택하는 옵션을 제공하는 것입니다. 인스턴스 ID를 사용하는 서비스에서 자동 초기화를 사용 중지하고 사용자에게 데이터 수집 동의에 대해 알리는 대화상자를 구현하고 동의를 받은 후 서비스를 직접 다시 사용 설정하면 됩니다.
인스턴스 ID를 사용하는 서비스에서 자동 초기화를 사용 중지하고 직접 초기화하는 방법을 알아보려면 아래 가이드를 읽어보세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-04-12(UTC)"],[],[],null,["| **Warning:** **The Instance ID API is deprecated.** If you need to access unique app installation identifiers, use the [Firebase installations](/docs/projects/manage-installations) API. See also [Firebase installations and Instance ID](/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\nInstance IDs identify individual installations of your app. Since each Instance\nID is unique to a particular app and device, they give Firebase services a way\nto refer to specific app instances. For example, Cloud Messaging uses\nInstance IDs to determine which devices to send messages to.\n\nSeveral Firebase services use Instance IDs to power their features:\n\n- Analytics\n- Crashlytics\n- Cloud Messaging\n- Remote Config\n\nManage app data associated with Instance IDs\n\nServices that use Instance IDs to identify installations also use them as a key to\nassociate relevant data with that device. For example, Crashlytics uses\nInstance IDs to record crashes that happen on the device, Remote Config uses\nthem to fetch configurations, and Analytics uses Instance IDs to track\nparticular audiences.\n\nData associated with Instance IDs is generally *not* personally-identifying,\nbut it can still be helpful to give users an option to manage it. To that\nend, Firebase offers two ways to manage Instance-ID-related data collection:\n\n- **Delete Instance IDs.** You can delete an Instance ID with a server- or client-side API call. Deleting an Instance ID deletes the ID itself and all data associated with it.\n- **Disable services that generate IDs.** Most Firebase services that use Instance IDs automatically generate a new ID if there isn't one on the device when they start up. To ensure your app doesn't create unwanted Instance IDs, disable auto-initialization for those services.\n\nDelete an Instance ID\n\nDeleting an Instance ID also deletes data associated with that ID in any of the\nFirebase services listed above. That makes ID deletion a helpful tool in\nclearing user data, but also comes with a caveat: if you're using multiple\nservices that rely on Instance IDs, deleting an ID clears data from *all* of\nthem.\n\nThe Instance ID service creates a new ID within a few days, unless you\ndisable all Instance-ID-generating services in your app. Firebase considers the\nnewly-created ID to be a brand new app instance, and doesn't associate it with\nthe previous ID in any way.\n| **Note:** Google Analytics uses its own form of Instance ID to keep track of analytics data. Deleting a regular Instance ID does *not* delete Analytics data. Learn how to [delete Analytics data associated with end users](https://support.google.com/firebase/answer/9019185#delete-on-mobile-device).\n\nDelete an ID with a client API call\n\nTo delete IDs generated by Firebase services, call the appropriate method from\nthe Firebase Instance ID API: \n\nSwift \n\n InstanceID.instanceID().deleteID { error in\n if let error = error {\n print(\"Error deleting instance ID: \\(error)\")\n }\n }\n\nObjective-C \n\n [FIRInstanceID instanceID] deleteIDWithHandler:^(NSError *error) {\n if error != nil {\n NSLog(@\"Error deleting instance ID: %@\", error);\n }\n }];\n\nAndroid \n\n FirebaseInstanceId.deleteInstanceId();\n\nDelete an ID with a server API call\n\nTo delete an Instance ID with server API calls, [add the Firebase Admin SDK to your server](//firebase.google.com/docs/admin/setup),\nif you haven't already.\n\nOnce it's added, delete IDs through a call to the Instance ID deletion function\nin your language of choice: \n\nNode.js \n\n // An Instance ID sent from a client service SDK\n const idToDelete = 'INSTANCE_ID';\n\n admin.instanceId().deleteInstanceId(idToDelete);\n\nJava \n\n // An Instance ID sent from a client service SDK\n String idToDelete = \"INSTANCE_ID\";\n\n FirebaseInstanceId.getInstance().deleteInstanceIdAsync(idToDelete).get();\n\nPython \n\n from firebase_admin import instance_id\n\n # An Instance ID sent from a client service SDK\n id_to_delete = 'INSTANCE_ID'\n\n instance_id.delete_instance_id(id_to_delete)\n\nGo \n\n client, err := app.InstanceId(ctx)\n if err != nil {\n log.Fatalln(\"error initializing client\", err)\n }\n\n iidToDelete := \"INSTANCE_ID\"\n if err := client.DeleteInstanceId(ctx, iidToDelete); err != nil {\n log.Fatalln(\"error deleting iid\", err)\n }\n\nWhen you delete an Instance ID with a server API call, Firebase services delete\nthe associated data, stop accepting new data for that ID, and, within a few days,\nnotify the client app that the ID was deleted. Until Firebase notifies the client\napp, some of the app's services might experience reduced functionality.\n\nIf you want to delete the current Instance ID and immediately use Firebase\nservices with a new, independent ID, use one of the Client APIs above to\nhandle the deletion.\n\nDisable Instance ID generation\n\nServices that use Instance IDs automatically generate a new ID when they're\ninitialized in an app that doesn't currently have one. Typically, those services\nalso automatically initialize when your app launches. To disable Instance\nID generation, you have to disable auto-initialization for services that use\nthem.\n\nA common approach is to give users an option to\nopt-in to data collection: disable auto-initialization for\nthe services that use Instance IDs, implement a dialog that prompts\nusers for their consent to data collection, and re-enable the services manually\nonce you have consent.\n\nRead the guides below to find out how to disable auto-initialization for\nInstance-ID-using services and instead manually initialize them:\n\n- Cloud Messaging: [Prevent Auto-initialization (Android)](//firebase.google.com/docs/cloud-messaging/android/client#prevent-auto-init) or [Prevent Auto-initialization (iOS+)](//firebase.google.com/docs/cloud-messaging/ios/client#prevent_auto_initialization)\n- Crash Reporting: [Enable Opt-in Reporting](//firebase.google.com/docs/crash/disable-sdk)\n- Analytics: [Configure Analytics Data Collection](/docs/analytics/configure-data-collection)\n\n| **Note:** Firebase Remote Config also generates Instance IDs, but isn't automatically initialized on app start. To delay ID generation in Remote Config, don't use the service until you're ready to generate an ID."]]