共有ストレージの概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
共有ストレージは、ユーザーがアプリをアンインストールした場合でも他のアプリからアクセスや保存を行うことができる、または行うべきユーザーデータに使用します。
Android には、次のタイプの共有可能データを保存しアクセスするための API が用意されています。
- メディア コンテンツ: この種のファイルには標準の公開ディレクトリが用意されているため、ユーザーはすべての写真に共通の場所を使用し、すべての音楽ファイル、音声ファイルなどに別の共通の場所を使用できます。アプリは、プラットフォームの
MediaStore
API を使用して、このコンテンツにアクセスできます。
- ドキュメントと他のファイル: システムには、PDF ドキュメントや EPUB 形式を使用する書籍など、他の形式のファイルを格納するための特別なディレクトリがあります。アプリはプラットフォームのストレージ アクセス フレームワークを使用して、このようなファイルにアクセスできます。
- データセット: Android 11(API レベル 30)以降では、複数のアプリが使用する可能性のある大規模なデータセットがキャッシュに保存されます。こうしたデータセットは、機械学習やメディア再生などのユースケースをサポートできます。アプリは
BlobStoreManager
API を使用して、このような共有データセットにアクセスできます。
API について詳しくは、次のガイドをご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-02-10 UTC。
[null,null,["最終更新日 2025-02-10 UTC。"],[],[],null,["# Overview of shared storage\n\nUse shared storage for user data that can or should be accessible to other apps\nand saved even if the user uninstalls your app.\n\nAndroid provides APIs for storing and accessing the following types of shareable\ndata:\n\n- **Media content:** The system provides standard public directories for these kinds of files, so the user has a common location for all their photos, another common location for all their music and audio files, and so on. Your app can access this content using the platform's [`MediaStore`](/reference/android/provider/MediaStore) API.\n- **Documents and other files:** The system has a special directory for containing other file types, such as PDF documents and books that use the EPUB format. Your app can access these files using the platform's Storage Access Framework.\n- **Datasets:** On Android 11 (API level 30) and higher, the system caches large datasets that multiple apps might use. These datasets can support use cases like machine learning and media playback. Apps can access these shared datasets using the [`BlobStoreManager`](/reference/android/app/blob/BlobStoreManager) API.\n\nFor more information about these APIs, see the following guides:\n\n- [Media content](/training/data-storage/shared/media)\n- [Documents and other files](/training/data-storage/shared/documents-files)\n- [Datasets](/training/data-storage/shared/datasets)"]]