Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release
, bukan aosp-main
, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Mengimplementasikan haptic
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Produsen perangkat umumnya dianggap sebagai pemilik aset pribadi
yang dibuat untuk setiap perangkat. Dengan demikian, upaya engineering mereka sering kali berfokus pada
per-perangkat; sedikit atau tidak ada upaya yang dilakukan untuk konsistensi perangkat
lain dalam ekosistem.
Sebaliknya, developer berupaya membuat aplikasi yang berfungsi di semua ponsel
Android dalam ekosistem, terlepas dari spesifikasi teknis setiap perangkat.
Perbedaan pendekatan ini dapat menyebabkan masalah fragmentasi, misalnya, kemampuan hardware ponsel tertentu tidak sesuai dengan ekspektasi yang ditetapkan oleh developer
aplikasi. Jadi, jika API haptik berfungsi di beberapa ponsel Android, tetapi tidak di ponsel lainnya,
hasilnya adalah ekosistem yang tidak konsisten. Itulah sebabnya konfigurasi hardware
berperan penting dalam memastikan bahwa produsen dapat menerapkan API
haptik Android di setiap perangkat.
Halaman ini menyediakan checklist langkah demi langkah untuk menyiapkan kepatuhan hardware untuk
penggunaan terbaik API haptik Android.
Gambar berikut mengilustrasikan pembuatan pengetahuan umum antara produsen
dan developer perangkat, yang merupakan langkah penting dalam menciptakan ekosistem
yang kohesif:
Gambar 1. Membangun pengetahuan antara produsen dan developer perangkat
Checklist penerapan haptic
Menerapkan konstanta
- Daftar konstanta untuk menerapkan haptik.
Menerapkan primitif
- Panduan penerapan untuk primitif komposisi HAL.
Memetakan konstanta antara HAL dan API
Menerapkan efek amplop linear terpisah (PWLE)
- Panduan penerapan untuk amplop frekuensi dan amplitudo.
Menilai hardware
- Petunjuk tentang target efek haptik. Gunakan petunjuk ini untuk melakukan
pemeriksaan cepat pada hardware Anda.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]