Qt Haptic Feedback on android
-
29-04-2021 - |
Question
I'm attempting to get my device to rumble but I'm having very little luck. My environment is HTC Sensation Android 2.3.3 API 10. Using Necessitas Qt Creater as my IDE.
Does nothing at all:
QFeedbackHapticsEffect::playThemeEffect( QFeedbackHapticsEffect::ThemeBasic );
Crashes my application:
QFeedbackHapticsEffect rumble;
rumble.setAttackIntensity(0.0);
rumble.setAttackTime(250);
rumble.setIntensity(1.0);
rumble.setDuration(100);
rumble.setFadeTime(250);
rumble.setFadeIntensity(0.0);
rumble.start();
rumble.stop();
I've specified my .pro file with the following
CONFIG += mobility
MOBILITY += feedback
and I'm using QTM_USE_NAMESPACE with the required headers included.
Edit:
I've set the following permissions:
android.permission.INTERNET
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.VIBRATE
However I still receive a segmentation fault.
Solution
According to this:
http://doc.qt.nokia.com/qtmobility-1.2/index.html#platform-compatibility
it's not one of the platforms that is feature complete at the current time.
OTHER TIPS
The API documentation for QFeedbackHapticsEffect
suggests that duration
should be greater than attackTime
+ fadeTime
. And, of course, stopping right after it starts probably isn't what you want, but hopefully that doesn't cause a seg fault. Does actuator()
return something useful? For that matter, does QFeedbackActuator::actuators()
give you a non-empty list?
I had the same Problem and did post a bug report with more details (still without reply) to http://groups.google.com/group/android-qt/browse_thread/thread/e1a4ad1c797b6694
It seems to be a problem in the Qt Mobility library for Android which probably can be fixed easily for someone who does compile his own library (I didn't do that yet).