P4A - AndroidVibrationModule
An Android Library that offers a mechanism for easily adding vibration feedback to Android applications.
The source code contains two main directories:
P4A_AndroidVibrationModule: This includes the source code of the P4A_AndroidVibrationModule
MyTestApp: This includes the source code of a sample application that uses the P4A_AndroidVibrationModule
The main features of the P4A AndroidVibrationModule include the following:
- A set of predefined vibration patterns
- Vibration feedback when different events are fired: ON_CLICK, ON_LONG_CLICK, ON_FOCUS_CHANGE, ON_KEY, ON_TOUCH, ON_MENU_ITEM_CLICK, ON_CREATE_CONTEXT_MENU, ON_DRAG
- Offering various functions for starting vibration, stoping vibration, examining if device supports vibration, etc.
A complete example showing how the P4A AndroidVibrationModule can be used to add vibration vibration feedback to various GUI components of an Android application can be found here.
Adding haptic feedback in a GUI component (e.g. button, etc.) can be achieved using the P4A AndroidVibrationModule by a simple line of code:
P4A_VibrationModule.getInstance(this).addVibrationFeedbackOnEventListener(P4A_VibrationModule.ON_CLICK, findViewById(R.id.button1), 2000);
The example above adds vibration feedback to "button1". In particular, when this button is clicked, it vibrates for 2 seconds.
Further examples can be found here.
The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7) under grant agreement No.610510