Hello everyone, So, I made this class in unity for haptic feedback but unfortunately as I figured out my device does not support neither the Vibrator class nor the HapticFeedback (both Vibrator.hasVibrator and View.isHapticFeedbackEnabled return false). Can someone tell me if the code below works with a device that has either vibration or haptic? Here is the code: Code (CSharp): using UnityEngine; public class AndroidHapticFeedback { //VibrationEffect Constants public const int EFFECT_CLICK = 0; //api 29 public const int EFFECT_DOUBLE_CLICK = 1; //api 29 public const int EFFECT_TICK = 2; //api 29 public const int EFFECT_HEAVY_CLICK = 5; //api 29 //HapticFeedback Constants public const int LONG_PRESS = 0; //api 3 public const int VIRTUAL_KEY = 1; //api 5 public const int KEYBOARD_TAP = 3; //api 8 public const int KEYBOARD_PRESS = 3; //api 27 public const int CLOCK_TICK = 4; //api 21 public const int CONTEXT_CLICK = 6; //api 23 public const int KEYBOARD_RELEASE = 7; //api 27 public const int VIRTUAL_KEY_RELEASE = 8; //api 27 #if UNITY_ANDROID private int apiLevel; private bool hasVibrator; private bool hasHapticFeedback; private AndroidJavaClass vibratorClass; private AndroidJavaClass vibrationEffectClass; private AndroidJavaClass viewClass; //private AndroidJavaClass unityActivity; #endif public AndroidHapticFeedback() { #if UNITY_ANDROID apiLevel = GetSDKInt(); vibratorClass = new AndroidJavaClass("android.os.Vibrator"); hasVibrator = vibratorClass.Call<bool>("hasVibrator"); if (hasVibrator) { vibrationEffectClass = new AndroidJavaClass("android.os.VibrationEffect"); } else { viewClass = new AndroidJavaClass("android.view.View"); hasHapticFeedback = viewClass.Call<bool>("isHapticFeedbackEnabled"); Toast.ShowToast("Has haptic: " + hasHapticFeedback.ToString()); } //unityActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); #endif } #if UNITY_ANDROID private int GetSDKInt() { var version = new AndroidJavaClass("android.os.Build$VERSION"); return version.GetStatic<int>("SDK_INT"); } #endif /// <summary> /// Gives the desired haptic feedback / vibration pattern if the device supports it /// TODO: need to find better method to determine what effect to play when an unavailable one is provided /// </summary> /// <param name="vibrationEffect">One of the constants of the AndroidHapticFeedback class</param> public void Execute(int vibrationEffect) { #if UNITY_ANDROID if (hasVibrator && apiLevel >= 29) // vibration effects are only supported with api level 29 and above (android 10) { vibratorClass.Call("vibrate", vibrationEffectClass.CallStatic<AndroidJavaClass>("createPredefined", vibrationEffect)); } else if(hasHapticFeedback && apiLevel >= 3) { viewClass.Call<bool>("performHapticFeedback", vibrationEffect); } #endif } }