How to make the Android Mobile vibrate in cocos 3.0


Hello everyone,
I want to make a game that run in Android.
Now I could create a touch listener, but I want to make the mobile vibrate when I touch it.
Is there any API to complete that?I’ve searched many times,but I couldn’t solve it.
Most of them complete it by using JNI, but I face many problem when I try to imitate them.
Maybe it’s due to the difference between 2.x and 3.0.
I would appreciate it very much if anyone who complete it in the newest version could share his method,


There is not API for it now.


@zhangxm Will you please explain how to do vibrate functionality in ios and android both while using cocos2d-x 3.2 . I really don’t get any help on this .


I think it is nothing about using cocos2d-x or not.
What’s your real question?
Don’t know how to use iOS and Android vibrate API or don’t know how to invoke obj-c/java code in c++ or else?

If it is about the vibrate API, i am not familiar with it too.


I have working implementation of vibrate on iOS and Android on FenneX:

The header file is in Classes/FenneX/NativeWrappers/NativeUtility.h.
iOS implementation is in proj.ios_mac/ios/Misc/
Android implemention have the C++ in and the Java somewhere in the src.


i jus don’t know how to invoke obj-c/java code in c++


I made a blog post about an easy way to do it. Thanks Fradow.