While not strictly an input device, it nevertheless is a kind of a peripheral. We felt it belonged in the input model. The vibrator allows you to vibrate the phone of a user. This can be used similar to more sophisticated force feedback functionality found commonly in game console controllers. The vibrator is only available on Android and needs a special permission in the manifest file

    1. android.permission.VIBRATE

    application configuration section if you are unsure how to specify permissions in your Android manifest. Vibrating the phone works as follows:

    1. Gdx.input.vibrate(2000);

    As the parameter is given in milliseconds the example above will vibrate the phone for 2 seconds. vibrate() method:

    1. Gdx.input.vibrate(new long[] { 0, 200, 200, 200}, -1);

    Javadocs) for more information. Prev | Next