ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
ติดตั้งใช้งานการโต้ตอบการสัมผัส
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โดยทั่วไปแล้ว ผู้ผลิตอุปกรณ์จะถือเป็นเจ้าของเนื้อหาส่วนตัวที่สร้างขึ้นสำหรับอุปกรณ์แต่ละเครื่อง ด้วยเหตุนี้ ความพยายามด้านวิศวกรรมจึงมักมุ่งเน้นที่อุปกรณ์แต่ละเครื่อง โดยให้ความสำคัญกับอุปกรณ์อื่นๆ ในระบบนิเวศน้อยมากหรือไม่ให้ความสำคัญเลย
ในทางตรงกันข้าม นักพัฒนาแอปพยายามสร้างแอปที่ใช้งานได้กับโทรศัพท์ Android ทุกรุ่นในระบบนิเวศ โดยไม่คำนึงถึงข้อกำหนดทางเทคนิคของแต่ละอุปกรณ์
ความแตกต่างของแนวทางนี้อาจทำให้เกิดปัญหาการแยกส่วน เช่น ความสามารถของฮาร์ดแวร์ของโทรศัพท์บางรุ่นไม่ตรงกับที่นักพัฒนาแอปคาดหวัง ดังนั้น หาก API ของการสัมผัสทำงานในโทรศัพท์ Android บางรุ่นแต่ไม่ทำงานในบางรุ่น ระบบนิเวศก็จะไม่สอดคล้องกัน ด้วยเหตุนี้ การกําหนดค่าฮาร์ดแวร์จึงมีบทบาทสําคัญในการช่วยให้ผู้ผลิตสามารถใช้ Androidhaptics API ในอุปกรณ์ทุกเครื่อง
หน้านี้มีรายการตรวจสอบแบบทีละขั้นตอนเพื่อตั้งค่าการปฏิบัติตามข้อกำหนดของฮาร์ดแวร์เพื่อให้ใช้ Android Haptics API ได้อย่างมีประสิทธิภาพสูงสุด
รูปภาพต่อไปนี้แสดงการสร้างความรู้ทั่วไประหว่างผู้ผลิตอุปกรณ์และนักพัฒนาแอป ซึ่งเป็นขั้นตอนสําคัญในการสร้างระบบนิเวศที่เหนียวแน่น
รูปที่ 1 การสร้างความรู้ระหว่างผู้ผลิตอุปกรณ์และนักพัฒนาแอป
รายการตรวจสอบการใช้งานการโต้ตอบการสัมผัส
ใช้ค่าคงที่
- รายการค่าคงที่เพื่อใช้การสัมผัส
ใช้องค์ประกอบพื้นฐาน
- คำแนะนำการใช้งานองค์ประกอบพื้นฐานของ HAL
แมปค่าคงที่ระหว่าง HAL กับ API
ใช้เอฟเฟกต์ของเส้นโค้งแบบเชิงเส้นแบบแบ่งส่วน (PWLE)
- คำแนะนำการใช้งานสำหรับแอมพลิจูดและย่านความถี่
ประเมินฮาร์ดแวร์
- วิธีการเกี่ยวกับเอฟเฟกต์การสัมผัสที่กำหนดเป้าหมาย ใช้วิธีการเหล่านี้เพื่อตรวจสอบฮาร์ดแวร์อย่างรวดเร็ว
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Implement haptics\n\nDevice manufacturers are generally considered the owners of the private assets\ncreated for each device. As such, their engineering efforts are often focused on\na *per-device basis*; little to no effort goes to the consistency of other\ndevices in the ecosystem.\n\nIn direct contrast, developers strive to build apps that work on *all* Android\nphones in the ecosystem, regardless of each device's technical specifications.\nThis difference in approach can cause a fragmentation problem, for example, the\nhardware capabilities of certain phones don't match expectations set by the app\ndevelopers. So if the haptics APIs work on some Android phones but not others,\nthe result is an inconsistent ecosystem. This is why hardware configuration\nplays a critical role in ensuring that manufacturers can implement Android\nhaptics APIs on *every* device.\n\nThis page provides a step-by-step checklist to set up hardware compliance for\nthe best use of the Android haptics APIs.\n\nThe following figure illustrates building common knowledge between device\nmanufacturers and developers, which is a critical step in creating a cohesive\necosystem:\n\n**Figure 1.** Building knowledge between device manufacturers and developers\n\nHaptics implementation checklist\n--------------------------------\n\n1. [Implement constants](/docs/core/interaction/haptics/haptics-constants-primitives#implement-constants)\n\n - List of constants to implement haptics.\n2. [Implement primitives](/docs/core/interaction/haptics/haptics-constants-primitives#implement-primitives)\n\n - Implementation guidance for HAL composition primitives.\n3. [Map constants between HAL and API](/docs/core/interaction/haptics/haptics-map-constants)\n\n - Mapping recommendations between public API constants (named *placeholders* in the framework) and HAL constants, which implement the placeholders.\n - See [Design principles to guide the recommended mapping](/docs/core/interaction/haptics/haptics-ux-design) to learn more about this process.\n4. [Implement piecewise linear envelope (PWLE) effects](/docs/core/interaction/haptics/haptics-pwle)\n\n - Implementation guidance for amplitude and frequency envelopes.\n5. [Assess the hardware](/docs/core/interaction/haptics/haptics-assess-hardware)\n\n - Instructions on target haptic effects. Use these instructions to perform quick checks on your hardware.\n\n| **Note:** You can learn more about building common knowledge between device manufacturers and developers in [Advanced Haptics: The When, What, and How of\n| Haptic APIs](https://www.youtube.com/watch?v=00jRoEFnpk8)."]]