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?
/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 insys/class/leds/vibrator/
. If files namedstate
,duration
,activate
etc. exist there, they can be watched to get vibrator events. On older devices same can be achieved throughtimed_output
if applicable.