5

I have a game which makes my device vibrate when a certain event happens. I want my device to play a sound when that event happens. Unfortunately, the developer doesn't seem to be interested in implementing the feature of having an alarm sound.

Maybe this shortcoming of the game can be bypassed by making my device playback a short notification sound when it vibrates. Unfortunately, I couldn't find any apps which can do this or even discussions regarding the same problem.

How do I achieve my objective?

3
  • 1
    It might be possible to use automation apps if there are other simultaneous events accompanying the vibration, but you have to find them by yourselves, perhaps by tracing the logcat (no guarantee though).
    – Andrew T.
    May 19 '20 at 6:38
  • 2
    /sys/class/timed_output/vibrator/enable exists at least on Qualcomm devices with vibrator a part of PMIC, connected to SoC via SPMI bus. Timed-output was a class driver (vibrator appeared as a virtual device) in staging tree available up to Android kernel 3.18. On later devices AOSP treats vibrator as an LED module and vibrator HAL uses hardware/vendor specific kernel interfaces in sys/class/leds/vibrator/. If files named state, duration, activate etc. exist there, they can be watched to get vibrator events. On older devices same can be achieved through timed_output if applicable. May 19 '20 at 7:52
  • 1
    Also theoretically an Xposed module can hook into AOSP's VibratorService methods to intercept vibrator calls. I haven't seen such mod/app though. May 19 '20 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.