Questions tagged [android-vibration]

The Android framework includes support for Vibration available on devices, allowing you to control the device's vibrations from your application. Questions regarding practical and advanced use of Vibrations must fall under this tag.

202 questions
602
votes
14 answers

How to make an Android device vibrate? with different frequency?

I wrote an Android application. Now, I want to make the device vibrate when a certain action occurs. How can I do this?
Billie
  • 8,938
  • 12
  • 37
  • 67
93
votes
2 answers

How can I request the vibrate permission?

How can I request the vibrate permission in my Android application?
Hardik Gajjar
  • 5,038
  • 8
  • 33
  • 51
65
votes
9 answers

Android vibrate is deprecated. How to use VibrationEffect in Android>= API 26?

I am using Android's VIBRATOR_SERVICE to give a haptic feedback for a button touch. ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(300); Android Studio give me warning that method vibrate(interval) is deprecated I should use…
Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154
40
votes
11 answers

Disable vibration for a notification

I'm writing an app using notification. Google developer guidelines encourages developers to provide settings to customize the notifications (disable vibration, set notification sound...), so I am trying to disable vibration for notifications if the…
nstCactus
  • 5,141
  • 2
  • 30
  • 41
17
votes
5 answers

Android Vibrate on touch?

I am trying to make my device vibrate when I touch an object on Screen. I am using this code: Vibrator v = (Vibrator) getSystemService(getApplicationContext().VIBRATOR_SERVICE); v.vibrate(300); with the permission in the manifest file but I…
Fofole
  • 3,398
  • 8
  • 38
  • 59
17
votes
5 answers

Vibrate when hold down button

I am making an app where the user holds down a button to make the phone vibrate and i'm not sure how to make it so only when the button is being held down it vibrates, my code so far is. package one.two.bn; import android.app.Activity; import…
Lucas
  • 191
  • 1
  • 1
  • 4
12
votes
9 answers

How to vibrate device n number of times through programming in android?

can anyone tell me how to vibrate same patter 5 times like this my pattern long[] pattern = { 0, 200, 500 }; i want this pattern to repeat 5 times Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(pattern…
Gkapoor
  • 840
  • 1
  • 13
  • 27
12
votes
4 answers

Phone vibration stops working after screen is off / locked

I have a service that checks for updates on my website and I would like it to be able to cause a vibration when a update is found even if the screen is off or locked. The vibration currently only works if the screen is not off / locked. All other…
Persson
  • 422
  • 4
  • 21
12
votes
2 answers

Android: Does Notification.DEFAULT_VIBRATE require vibrate permission?

Sometimes I read that notification.defaults|= Notification.DEFAULT_VIBRATE; and notification.defaults = Notification.DEFAULT_ALL; requires the vibrate permission But…
Xander
  • 5,487
  • 14
  • 49
  • 77
11
votes
5 answers

How to disable/re-enable the vibration that occurs on receiving notification?

I am defining a custom vibration for a specific functionality when notification is received. However, when the phone screen is off, the custom vibration plays along with the default notification vibration. I tried to put phone to silent mode and…
SoulRayder
  • 5,072
  • 6
  • 47
  • 93
11
votes
1 answer

Android Emulator Vibration Test?

Is there a way to test vibrations on the Virtual Devices that come with Android Studio? I tried searching logcat and it seems like there isn't any indication of when the Android device is vibrating or not.
Eric Fox
  • 111
  • 1
  • 3
11
votes
3 answers

Algorithm for generating vibration patterns ranging in intensity in Android?

I am attempting to programmatically generate Android vibration patterns with 'micro pulses' on and off to control how strong the vibration feels to the end user. This is the solution I've seen recommended in a few similar topics, to the problem of…
paulscode
  • 1,049
  • 1
  • 12
  • 29
10
votes
2 answers

How to Vibrate the system default pattern in Android?

I know about the Vibrate class and how to use it, but where can I get the system default vibration pattern to use? Or is there some kind of intent I can launch to get the system to vibrate its default vibration?
Mohamed Hafez
  • 8,621
  • 7
  • 41
  • 49
10
votes
1 answer

Stop vibration in android when activity is finished

I am running this on button click in my android app: public void vibrateold() { Vibrator vibrate = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrate.vibrate(4000); } But the vibration doesn't stop when leaving the activity…
user2715467
  • 245
  • 3
  • 9
9
votes
2 answers

Android vibration app doesn't work anymore after Android 10, API 29 update

so I made an app a couple months back that helped me improve my sleep. I have sleeping issues and, it sounds odd, but I use the app to vibrate my phone when I go to bed to give myself something to focus on to go to sleep, it is currently a vital…
geniye
  • 95
  • 1
  • 6
1
2 3
13 14