title: Android vibrate is deprecated. How to use VibrationEffect in Android>= API 26?
body: <p>I am using Android's <code>VIBRATOR_SERVICE</code> to give a haptic feedback for a button touch.</p>
  
  <pre><code> ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(300);
  </code></pre>
  
  <p>Android Studio give me warning that method <code>vibrate(interval)</code> is deprecated I should use <code>VibrationEffect</code> for API>23. </p>
  
  <p>So I used<code>VibrationEffect</code>'s method <code>createOneShot</code> which takes 2 params: interval, and amplitude. 
  <a href="https://i.stack.imgur.com/U8nyK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/U8nyK.png" alt="enter image description here"></a></p>
  
  <p>I tried searching for it but got no clue about what to pass as <code>amplitude</code>, anybody got any idea about how to use it?</p>
  
  <p><strong>Update Added code</strong></p>
  
  <pre><code>// Vibrate for 150 milliseconds
  private void shakeItBaby() {
      if (Build.VERSION.SDK_INT &gt;= 26) {
          ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(150,10));
      } else {
          ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(150);
      }
  }
  </code></pre>