| Summary: | Android vibration not being found as haptic device | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Jade Macho <nuda1998> |
| Component: | haptic | Assignee: | Sylvain <sylvain.becker> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | martin.gerhardy, philipp.wiesemann |
| Version: | HG 2.1 | ||
| Hardware: | All | ||
| OS: | Android (All) | ||
| Attachments: | Sample code to call the Android Vibrator. | ||
I knew that I would screw something up. Clarification and addition to my previous comment: With "accessible via JNI" I meant "you must call Java code via the JNI environment", not "you must call native code to make the device vibrate", but that should be clear from the sample code. Something I completely forgot to mention is that to use Vibrator, the app requires the VIBRATE permission in its manifest. I don't know how much of an issue this is for SDL. If this gets applied. Please check whether the cmake support for android is already part of the CMAkeLists.txt and make sure that the haptic stuff is also supported then from within the cmake file. This is now implemented, thanks! |
Created attachment 2309 [details] Sample code to call the Android Vibrator. Some Android devices, if not all phones, support vibration. It would be nice to access the vibration via SDL just like any other haptic device (similarly to how the accelerometer is being handled as joystick). I've attached some example code to call the Vibrator. It is (as far as I know) only accessible via JNI and with the activity context (mSingleton in SDLActivity if I understood correctly). I don't feel experienced enough to mimic the implementation of the accelerator as joystick and _not_ screw up everything (f.e. I don't know what SDL_HapticQuery should return). I'll at least test any related changes when / if available. This is my first bug report here (this isn't a bug, but I've been linked to submit this here) so I'm sorry if this is not where it belongs or doesn't contain enough information.