ภาพรวมของกิจกรรมบนเว็บที่เชื่อถือได้
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
กิจกรรมในเว็บซึ่งเชื่อถือได้เป็นวิธีใหม่ในการเปิดเนื้อหาเว็บแอปของคุณ เช่น Progressive Web App (PWA) ของคุณ จากแอป Android ของคุณโดยใช้โปรโตคอลที่อิงตามแท็บที่กำหนดเอง
หมายเหตุ: กิจกรรมในเว็บซึ่งเชื่อถือได้พร้อมใช้งานใน Chrome ใน Android เวอร์ชัน 72 ขึ้นไป
หากต้องการดูรหัส
กิจกรรมในเว็บซึ่งเชื่อถือได้แตกต่างจากวิธีอื่นๆ ในการเปิดเนื้อหาเว็บจากแอป Android ตรงจุดต่อไปนี้
- เนื้อหาในกิจกรรมในเว็บซึ่งเชื่อถือได้จะเชื่อถือได้ เนื่องจากแอปและเว็บไซต์ที่เปิดขึ้นนั้นคาดว่าจะมาจากนักพัฒนาแอปรายเดียวกัน (ซึ่งจะยืนยันโดยใช้ลิงก์เนื้อหาดิจิทัล)
- เนื้อหาที่แสดงผลในกิจกรรมบนเว็บที่เชื่อถือได้มาจากเว็บ โดยเบราว์เซอร์ของผู้ใช้จะแสดงผลเนื้อหาเหล่านั้นในลักษณะเดียวกับที่ผู้ใช้จะเห็นในเบราว์เซอร์ ยกเว้นว่าเนื้อหาจะแสดงแบบเต็มหน้าจอ เนื้อหาเว็บต้องเข้าถึงได้และมีประโยชน์ในเบราว์เซอร์ก่อน
- นอกจากนี้ เบราว์เซอร์จะอัปเดตโดยอิสระจาก Android และแอปของคุณ ซึ่งจะช่วยประหยัดขนาด APK และช่วยให้คุณใช้รันไทม์เว็บสมัยใหม่ได้ (โปรดทราบว่าตั้งแต่ Lollipop WebView ได้รับการอัปเดตแยกจาก Android ด้วย แต่มีผู้ใช้ Android ก่อน Lollipop อยู่จํานวนมาก)
- แอปโฮสต์ไม่มีสิทธิ์เข้าถึงเนื้อหาเว็บโดยตรงในกิจกรรมบนเว็บที่เชื่อถือได้หรือสถานะเว็บประเภทอื่นๆ เช่น คุกกี้และ
localStorage
อย่างไรก็ตาม คุณสามารถประสานงานกับเนื้อหาเว็บได้โดยการส่งข้อมูลจากหน้าเว็บไปยังหน้าเว็บใน URL (เช่น ผ่านพารามิเตอร์การค้นหาและ Intent URI)
- การเปลี่ยนระหว่างเนื้อหาบนเว็บกับเนื้อหาที่แสดงในหน้าเว็บจะอยู่ระหว่างกิจกรรม กิจกรรมแต่ละรายการ (เช่น หน้าจอ) ของแอปมาจากเว็บหรือกิจกรรม Android โดยสมบูรณ์
ปัจจุบันเนื้อหาที่เปิดในตัวอย่างของกิจกรรมในเว็บที่เชื่อถือได้ยังไม่ผ่านเกณฑ์ เพื่อให้ทดสอบได้ง่ายขึ้น อย่างไรก็ตาม กิจกรรมในเว็บที่เชื่อถือได้ต้องเป็นไปตามข้อกำหนดเดียวกันของเพิ่มลงในหน้าจอหลัก คุณสามารถตรวจสอบเว็บไซต์เพื่อดูข้อกําหนดเหล่านี้ได้โดยใช้การตรวจสอบ "ผู้ใช้สามารถได้รับข้อความแจ้งให้เพิ่มลงในหน้าจอหลัก" ของ Lighthouse
ปัจจุบันเบราว์เซอร์อื่นๆ สามารถใช้โปรโตคอลเดียวกับที่กิจกรรมในเว็บที่เชื่อถือได้ใช้ แม้ว่าแอปโฮสต์จะมีสิทธิ์ตัดสินใจขั้นสุดท้ายเกี่ยวกับเบราว์เซอร์ที่จะเปิด แต่เราขอแนะนำให้ใช้นโยบายเดียวกับแท็บที่กำหนดเอง ซึ่งก็คือใช้เบราว์เซอร์เริ่มต้นของผู้ใช้ ตราบใดที่เบราว์เซอร์นั้นมีความสามารถที่จำเป็น
ไปที่ไหนต่อดี
หากต้องการสร้างแอป Android ที่เริ่มต้นและเปิด PWA ได้อย่างรวดเร็ว โปรดดูคู่มือเริ่มใช้งานฉบับย่อ
หากต้องการผสานรวมกิจกรรมบนเว็บที่เชื่อถือได้เข้ากับแอป Android ที่มีอยู่ คำแนะนำการผสานรวมเป็นจุดเริ่มต้นที่ดี
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 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-07-27 UTC"],[],[],null,["# Overview of Trusted Web Activities\n\n**Trusted Web Activity** is a new way to open *your* web-app content such as *your* Progressive Web App (PWA) from *your* Android app using a protocol based on Custom Tabs.\n\n**Note** : Trusted Web Activity is available in [Chrome on Android](https://play.google.com/store/apps/details?id=com.android.chrome), version 72 and above.\n\n*Looking for the code?*\n\n- [android-browser-helper library on GitHub](https://github.com/GoogleChrome/android-browser-helper)\n- [Trusted Web Activity demos](https://github.com/GoogleChrome/android-browser-helper/tree/master/demos)\n- [Bubblewrap, a NodeJs library / CLI to generate and build Trusted Web Activity projects](https://github.com/GoogleChromeLabs/bubblewrap)\n\nThere are a few things that make Trusted Web Activity different from other ways to open web content from your Android app:\n\n1. Content in a Trusted Web activity is **trusted** -- the app and the site it opens are expected to come from the same developer. (This is verified using [Digital Asset Links](https://developers.google.com/digital-asset-links/v1/getting-started).)\n2. The content rendered in a Trusted Web Activity comes from the **web**: they're rendered by the user's browser, in exactly the same way as a user would see it in their browser except they are run fullscreen. Web content must be accessible and useful in the browser first.\n3. Browsers are also updated independent of Android and your app. That saves on APK size and ensures you can use a modern web runtime. (Note that since Lollipop, WebView has also been updated independent of Android, but there are a [significant number](/about/dashboards) of pre-Lollipop Android users.)\n4. The host app doesn't have direct access to web content in a Trusted Web Activity or any other kind of web state, like cookies and `localStorage`. Nevertheless, you can coordinate with the web content by passing data to and from the page in URLs (e.g. through query parameters and [intent URIs](https://developer.chrome.com/docs/multidevice/android/intents).)\n5. Transitions between web and native content are between **activities**. Each activity (i.e. screen) of your app is either completely provided by the web, or by an Android activity\n\nTo make it easier to test, there are currently no qualifications for content opened in the preview of Trusted Web activities. You can expect, however, that Trusted Web activities need to meet the same [Add to Home Screen](https://web.dev/customize-install#criteria) requirements. You can audit your site for these requirements using the [Lighthouse](https://web.dev/measure/) \"*user can be prompted to Add to Home screen*\" audit.\n\nToday, it is possible for other browsers to implement the same protocol that Trusted Web activities use. While the host app has the final say on what browser gets opened, we recommend the same policy as for Custom Tabs: use the user's default browser, so long as that browser provides the required capabilities.\n\nWhere to go next?\n-----------------\n\nIf you are looking for quickly building an Android app that just starts and opens your PWA, checkout out the [Quick Start Guide](https://developer.chrome.com/docs/android/trusted-web-activity/quick-start).\n\nIf integrating Trusted Web Activity into an existing Android App, the [Integration Guide](https://developer.chrome.com/docs/android/trusted-web-activity/integration-guide) is a good place to get started."]]