benjamindean/flutter_vibration

Vibration is not working on Android 10

Closed this issue · 5 comments

Vibration is not working for Android 10

I have already added below the line in my AndroidManifest.xml:
<uses-permission android:name="android.permission.VIBRATE"/>

Code for Vibration:

if (Vibration.hasVibrator() != null) {
     if (Vibration.hasAmplitudeControl() != null) {
          Vibration.vibrate(duration: 500,amplitude: 128,);
      } else {
          Vibration.vibrate();
      }
}

In case of Android 10 hasAmplitudeControl condition is satisfied and also there is no error but still, the device is not vibrating.

I'm unable to test it on Android 10 at the moment. Is there anything related to vibration in logs?

No, there is no error in the logs. But I think you will have to test and provide a solution for android 10 because nowadays more than enough android devices are upgrading to Android 10.

True. I'll find some way to test it then.

True. I'll find some way to test it then.

@benjamindean I tried this library in multiple devices with Android 10 and vibration is not working in only Pixel 3 xl device. Apart from this I tried in Samsung M20, Pixel and Oneplus 6 and the vibration is working fine on these phones with Android 10. So I am closing the issue because it seems to be a device-specific issue.

nohli commented

In case that anyone else encounters the same problem:
Battery Saver seems to disable haptic feedback. Turn it off and it vibrates.