[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# RCS Google Messages archival\n\nBackground\n----------\n\nThis document outlines how to integrate with, test, and validate the RCS\narchival feature in Google Messages.\n\n### Solution overview\n\n- **Client-side archival:** Archival vendors need to develop an Android app for IT admins to deploy on their managed devices.\n- **Powered by Google Messages:** This feature requires Google Messages to be the [default messaging app](https://support.google.com/messages/answer/6089066). IT admins can use Android Enterprise controls to enforce the default.\n- **Requires Android Enterprise:** This feature is available only on fully managed devices.\n\n| **Important:** Work profiles (on neither personally-owned nor company-owned devices) are not supported.\n\n### Workflow\n\n**Figure 1.** RCS archival workflow.\n\n1. IT admin deploys archival app using Android Enterprise.\n2. **Optional** : IT admin programmatically configures archival app using Android Enterprise controls.\n - Required:\n - The archival app needs [`READ_SMS`](/reference/android/Manifest.permission#READ_SMS) permission\n - Recommended:\n - [Disallow user control](/reference/android/app/admin/DevicePolicyManager#setUserControlDisabledPackages(android.content.ComponentName,%20java.util.List%3Cjava.lang.String%3E)) over Google Messages and archival app\n - IT admin [enforces](/reference/android/os/UserManager?_gl=1*wrcrs6*_up*MQ..*_ga*MTgxMTgzNzc3NC4xNzM4NjY5MDMy*_ga_6HH9YJMN9M*MTczODY2OTAzMS4xLjAuMTczODY2OTAzMS4wLjAuMTQ0OTczNTMyMg..#DISALLOW_CONFIG_DEFAULT_APPS) Google Messages as the default SMS/RCS client\n - Optionally, IT admin can pre-enroll archival app using MCM as well, if archival solution supports MCM\n3. IT admin enables archival in Google Messages using [MCM](#google-messages-mcm-schema).\n4. Google Messages writes message data to Android on message events. A message event is one of: message sent, message received, message edited, or message deleted.\n5. Google Messages [notifies archival app](#notification-to-archival-app) of new message event, for both RCS and SMS/MMS messages.\n6. The archival app reads the message data from the [`Telephony`](/reference/android/provider/Telephony) provider.\n7. The archival app batches updates and sends them to the server.\n\nImplementation\n--------------\n\n### Google Messages MCM schema\n\nArchival is configured in Google Messages using the `messages_archival` key,\nwhich accepts a string value for admins to specify their archival app by package\nname. If the value is empty, null, or the key is not present, archival is\ndisabled. If the value is specified, archival is enabled, and Google Messages\nsends an explicit broadcast to the specified package name on a message event.\n\n### Notification to archival app\n\n- An explicit broadcast is sent to the specified archial app, with the action: `GOOGLE_MESSAGES_ARCHIVAL_UPDATE`\n- In some cases, the message URI is included in the broadcast extras, which can be used to fetch the message that triggered the broadcast: `com.google.android.apps.messaging.EXTRA_ARCHIVAL_URI`\n\n### Archival app requirements\n\n**Required:**\n\n- Claim the [FOREGROUND_SERVICE permission](/reference/android/Manifest.permission?_gl=1*ir8law*_up*MQ..*_ga*NDcyNDIyNTk3LjE3NDAzOTEzODM.*_ga_6HH9YJMN9M*MTc0MDM5MTM4My4xLjAuMTc0MDM5MTM4My4wLjAuMTM5NTk3NjU1Nw..#FOREGROUND_SERVICE).\n- Declare a foreground service in your manifest, which includes the intent filter for the archival update broadcast, and is [permission-granted](/privacy-and-security/risks/access-control-to-exported-components#permission-based-access-control-to-exported-components-mitigations) to assure only Google Messages can start the service.\n\n \u003cservice\n android:enabled=\"true\"\n android:foregroundServiceType=\"shortService\"\n android:name=\".TestService\"\n android:exported=\"true\"\n android:permission=\"android.permission.WRITE_SMS\"\u003e\n \u003cintent-filter\u003e\n \u003caction android:name=\"GOOGLE_MESSAGES_ARCHIVAL_UPDATE\" /\u003e\n \u003c/intent-filter\u003e\n \u003c/service\u003e\n\n- Implement that service to handle the intent, read from telephony, and determine the type of the message event by comparing the prior state of telephony with the current state, and then cache both the message event to be uploaded to the archival service backend, and the updated state of Telephony to compare against on the next event.\n\n**Recommended:**\n\n- Batch updates of message events to the server with [`JobScheduler`](/reference/android/app/job/JobScheduler).\n\n | **Important:** Don't attempt to sync every message event with your backend in your service.\n - IT admins can guarantee your app isn't killed or your app data deleted by users, making sure your batched updates can proceed as expected.\n - Minimizing foreground service time to just the critical archival requirement minimizes UX and system health impact.\n- Enable programmatic configuration of your app using MCM (as mentioned in\n [Messages MCM schema](#google-messages-mcm-schema)), so users don't need to sign in or specify server\n enrollment details manually.\n\nTesting\n-------\n\nTo test your implementation, use [TestDPC](https://github.com/googlesamples/android-testdpc) or your preferred EMM\nclient."]]