How to make android phone vibrate

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By stevkastt

I am making a game for android and I want the phone to vibrate when the player is beaten but I get this error:

Invalid call. Nonexistent function ‘vibrate_handheld’ in base ‘InputDefault’.

My code to when the player is beaten is the next:

func _on_PlayerShip_area_entered(area):
if can_get_damage and !area.get_collision_layer_bit(4): 
	can_get_damage = false

I did follow this thread to get the code I needed to use and the docs to test it, but I don’t get more information about this problem.

In advance Thanks for your help.

I have the same issue. Not high on my list, so I’ve commented to see if anyone else replies.
I would have thought vibration would be a built in thing.

deaton64 | 2020-05-08 23:04

Well, it could be a good thing to integrate in some games, sure it is not that important for the most. Les’t wait.

stevkastt | 2020-05-09 09:07

:bust_in_silhouette: Reply From: RedCube

It might be the phone/tablet your’e using. It works fine for my phone but never worked on my tablet. I’ll suggest to try it on another device. Also, maybe it’s because of the code. Try to send a vibrate call in the ready function just to make sure. Hope this helps! , also let me know if you find a way to make it work on table :wink:

:bust_in_silhouette: Reply From: AkMor

Have you ticked the box ‘Vibrate’ at android export?

so simple and so easily missed!
thank you for your help.

d.dastan | 2022-08-25 10:33

thanks that solved my problem.

morningkingdom | 2022-09-04 09:17