Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Haptics on Android
Qt 6.11 is out! See what's new in the release blog

Haptics on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 511 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TomZT Offline
    TomZT Offline
    TomZ
    wrote on last edited by
    #1

    Just a generic question, did anyone manage to get haptics (vibrations) working on Android on their Qt / QML application?

    I tried for most of today before giving up.

    • the Android call View.performHapticFeedback hits the snag that there doesn't seem to be any way to get a "View" instance in a QML application.
      Using the context.getWindow().getDecoreView() gives you a view, but not sure why, calling the haptics on there didn't do anything.
    • Calling the following Java likewise had no effect:
     public static void click(Context context) {
         VibratorManager vm = (VibratorManager) context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
         Vibrator vibrator = vm.getDefaultVibrator();
         vibrator.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK));
       }
    
    // additionally added to the manifest this line:
     <uses-permission android:name="android.permission.VIBRATE"/>
    
    

    If anyone knows of a Qt app that successfully added haptics (simple is fine), please do share the details!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved