ภาพรวมของพื้นที่เก็บข้อมูลที่ใช้ร่วมกัน
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ใช้พื้นที่เก็บข้อมูลที่ใช้ร่วมกันสำหรับข้อมูลผู้ใช้ที่แอปอื่นๆ ควรเข้าถึงได้หรือสามารถเข้าถึงได้ และบันทึกไว้แม้ว่าผู้ใช้จะถอนการติดตั้งแอปของคุณแล้วก็ตาม
Android มี API สำหรับจัดเก็บและเข้าถึงข้อมูลต่อไปนี้ซึ่งแชร์ได้
- เนื้อหาสื่อ: ระบบจะมีไดเรกทอรีสาธารณะมาตรฐานสำหรับไฟล์ประเภทเหล่านี้ เพื่อให้ผู้ใช้มีตำแหน่งทั่วไปสำหรับรูปภาพทั้งหมด ตำแหน่งทั่วไปอีกตำแหน่งสำหรับเพลงและไฟล์เสียงทั้งหมด และอื่นๆ แอปของคุณจะเข้าถึงเนื้อหานี้ได้โดยใช้
MediaStore
API ของแพลตฟอร์ม
- เอกสารและไฟล์อื่นๆ: ระบบมีไดเรกทอรีพิเศษสำหรับเก็บไฟล์ประเภทอื่นๆ เช่น เอกสาร PDF และหนังสือที่ใช้รูปแบบ EPUB แอปของคุณเข้าถึงไฟล์เหล่านี้ได้โดยใช้เฟรมเวิร์กการเข้าถึงพื้นที่เก็บข้อมูลของแพลตฟอร์ม
- ชุดข้อมูล: ใน Android 11 (API ระดับ 30) ขึ้นไป ระบบจะแคชชุดข้อมูลขนาดใหญ่ที่แอปหลายแอปอาจใช้ ชุดข้อมูลเหล่านี้รองรับกรณีการใช้งานต่างๆ เช่น แมชชีนเลิร์นนิงและการเล่นสื่อ แอปเข้าถึงชุดข้อมูลที่แชร์เหล่านี้ได้โดยใช้
BlobStoreManager
API
ดูข้อมูลเพิ่มเติมเกี่ยวกับ API เหล่านี้ได้ในคู่มือต่อไปนี้
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-02-10 UTC
[[["เข้าใจง่าย","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-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)"]]