การกรองระดับการมองเห็นแพ็กเกจใน Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมื่อแอปกำหนดเป้าหมายเป็น Android 11 (API ระดับ 30) ขึ้นไปและค้นหา
ข้อมูลเกี่ยวกับแอปอื่นๆ ที่ติดตั้งในอุปกรณ์ ระบบจะ
กรองข้อมูลนี้โดยค่าเริ่มต้น ลักษณะการกรองนี้หมายความว่าแอปของคุณ
ไม่สามารถตรวจหาแอปทั้งหมดที่ติดตั้งในอุปกรณ์ ซึ่งจะช่วยลด
ข้อมูลที่อาจมีความละเอียดอ่อนซึ่งแอปของคุณเข้าถึงได้แต่ไม่จำเป็น
ต่อการใช้งาน
นอกจากนี้ การมองเห็นแพ็กเกจที่กรองแล้วยังช่วยให้ App Store อย่าง Google Play ประเมินความเป็นส่วนตัวและความปลอดภัยที่แอปของคุณมอบให้แก่ผู้ใช้ได้ด้วย ตัวอย่างเช่น Google Play ถือว่ารายการแอปที่ติดตั้งเป็นข้อมูลส่วนบุคคลและข้อมูลผู้ใช้ที่ละเอียดอ่อน
ระดับการเข้าถึงแอปอย่างจำกัดจะส่งผลต่อผลลัพธ์ที่ส่งคืนโดยวิธีการที่ให้ข้อมูลเกี่ยวกับแอปอื่นๆ เช่น
queryIntentActivities()
getPackageInfo()
และ
getInstalledApplications()
การมองเห็นที่จำกัดยังส่งผลต่อการโต้ตอบอย่างชัดเจนกับแอปอื่นๆ ด้วย เช่น
การเริ่มบริการของแอปอื่น
บางแพ็กเกจจะมองเห็นได้
โดยอัตโนมัติ แอปของคุณจะตรวจหาแพ็กเกจเหล่านี้ได้เสมอ
ในการค้นหาแอปอื่นๆ ที่ติดตั้งไว้ หากต้องการดูแพ็กเกจอื่นๆ ให้ประกาศความต้องการระดับการเข้าถึงแพ็กเกจที่เพิ่มขึ้นของแอปโดยใช้องค์ประกอบ <queries>
หน้ากรณีการใช้งานมีตัวอย่างวิธีขยายระดับการมองเห็นแพ็กเกจแบบเลือก เวิร์กโฟลว์ที่อธิบายไว้ในเอกสารดังกล่าวจะช่วยให้คุณดำเนินการตามสถานการณ์การโต้ตอบกับแอปทั่วไปได้ในขณะที่ปกป้องความเป็นส่วนตัวของผู้ใช้
ในกรณีที่พบไม่บ่อยนักซึ่งองค์ประกอบ <queries>
ไม่ได้ให้ระดับการมองเห็นแพ็กเกจที่เพียงพอ คุณสามารถใช้สิทธิ์ QUERY_ALL_PACKAGES
ได้ หากคุณเผยแพร่แอปใน Google Play การใช้สิทธิ์นี้ของแอปจะขึ้นอยู่กับการอนุมัติ
หน้าเกี่ยวกับการทดสอบลักษณะการทำงานของการแสดงแพ็กเกจ
มีคำแนะนำเกี่ยวกับวิธีทดสอบการเปลี่ยนแปลงลักษณะการทำงานตามระดับการแสดงแพ็กเกจ
เมื่อแอปของคุณต้องอาศัยการโต้ตอบกับแอปอื่นๆ
แหล่งข้อมูลเพิ่มเติม
ดูข้อมูลเพิ่มเติมเกี่ยวกับระดับการมองเห็นแพ็กเกจใน Android ได้จากสื่อต่อไปนี้
บล็อกโพสต์
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-21 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-08-21 UTC"],[],[],null,["# Package visibility filtering on Android\n\nWhen an app targets Android 11 (API level 30) or higher and queries for\ninformation about the other apps that are installed on a device, the system\nfilters this information by default. This filtering behavior means that your app\ncan't detect all the apps installed on a device, which helps minimize the\npotentially sensitive information that your app can access but doesn't need\nto fulfill its use cases.\n\nAlso, filtered package visibility helps app\nstores like Google Play assess the privacy and security that your app provides\nfor users. For example, Google Play considers the list of installed apps to be\n[personal and sensitive user\ndata](https://support.google.com/googleplay/android-developer/answer/10144311#zippy=%2Cexamples-of-common-violations).\n\nLimited app visibility affects the results returned by methods that give\ninformation about other apps, such as\n[`queryIntentActivities()`](/reference/android/content/pm/PackageManager#queryIntentActivities(android.content.Intent,%20int)),\n[`getPackageInfo()`](/reference/android/content/pm/PackageManager#getPackageInfo(java.lang.String,%20int)),\nand\n[`getInstalledApplications()`](/reference/android/content/pm/PackageManager#getInstalledApplications(int)).\nThe limited visibility also affects explicit interactions with other apps, such\nas starting another app's service.\n\nSome packages are [visible\nautomatically](/training/package-visibility/automatic). Your app can always\ndetect these packages in its queries for other installed apps. To view other\npackages, [declare your app's need for increased package\nvisibility](/training/package-visibility/declaring) using the\n[`\u003cqueries\u003e`](/guide/topics/manifest/queries-element) element. The [use\ncases](/training/package-visibility/use-cases) page provides examples of how you\ncan selectively expand package visibility. The workflows described there allow\nyou to fulfill common app interaction scenarios while protecting user privacy.\n\nIn the rare cases where the `\u003cqueries\u003e` element doesn't provide adequate package\nvisibility, you can use the `QUERY_ALL_PACKAGES` permission. If you publish your\napp on Google Play, your app's use of this permission is\n[subject to approval](https://support.google.com/googleplay/android-developer/answer/10158779).\n\nThe page about\n[testing package visibility behavior](/training/package-visibility/testing)\noffers suggestions for how to test behavior changes based on package visibility\nwhen your app relies on interactions with other apps.\n\nAdditional resources\n--------------------\n\nTo learn more about package visibility on Android, view the following materials:\n\n### Blog posts\n\n- [Package visibility in\n Android 11](https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9), available on Medium."]]