Hi I just found old post of making the device vibrate. Using JNI and other similar post but I know that cocos 2d-x now have a device vibration.
Of course I think with just this the phone will be vibrate.
But not it will crash.
float _duration = 2.0f;
Device::vibrate(_duration);
EDIT:
Looks like I forgot to ask the permissions for android. If you don’t ask for the vibrate permisions in Android it will not work.
Of course that code will work, I’m not sure but I think we must specify in what platform we can do this,I mean windows desktop cannot vibrate some #if will be nice.