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
9
votes
3 answers

Detect the device is vibrating?

I have used the below code to vibrate the device. public void vibrator() { try { Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(5000); } catch (Exception e) { Log.d(TAG,…
user3586231
  • 391
  • 4
  • 21
9
votes
3 answers

enable/disable keyboard sound and vibration programmatically

I'm trying to find a way to disable and enable keyboard sound and vibration when tapping keys. I've searched on Stack Overflow and other Android Forums but i didn't found any result. I've tried AudioManager to enable vibrate mode, but i want to…
Houcine
  • 24,001
  • 13
  • 56
  • 83
8
votes
4 answers

How to trigger Vibration on Sound Input?

I am trying to create an android application where I filter one specific frequency of a beep and make the phone vibrate. I am taking input from the MIC of mobile and using MediaRecorder class, by using this class, I can record, save and play the…
Momo Pomo
  • 265
  • 2
  • 5
  • 19
8
votes
2 answers

Vibrate an Android Wear device on notification

I'm trying to develop an app for android and Android Wear (Wear OS). I create a Notification from the mobile to the watch. notification = new NotificationCompat.Builder(context) .setSmallIcon(icon) …
7
votes
2 answers

VIBRATE permission as optional

I have an app (already released) in which I've developed new feature with vibration. So I've added new permission: After releasing update I've noticed that my Nexus 7 2013 didn't…
snachmsm
  • 17,866
  • 3
  • 32
  • 74
7
votes
0 answers

Android Device default vibrate pattern

I tried to vibrate my app with device's default vibration settings but i can not do it with using Vibration. I tried it code which is below. case AudioManager.RINGER_MODE_VIBRATE: Vibrator vibrator = (Vibrator)…
iravul
  • 408
  • 9
  • 15
7
votes
1 answer

Android - How to make the phone vibrate to the music playing

I am new to Android development. I want to make an app that is essentially a music player but the phone can vibrate to the beat of the music playing. I remember the earliest Nokia phones had this feature, I want to recreate this for fun. My…
6
votes
2 answers

How to keep the vibrator on indefinitely from a service or receiver

I need to alert the user of certain events by means of: Vibration Notification The vibration should remain on indefinitely until the user ACKs the notification. The problem is vibration stops when the device goes to sleep. I've read the following…
Mister Smith
  • 27,417
  • 21
  • 110
  • 193
5
votes
0 answers

Calling Android Vibrator vibrate function several times stops vibration

My app should react with vibration, when a number sends a text message. The vibration should go on until the user touches a button. While testing the application, I'm sending multiple text messages from different devices, including the one with the…
adamb
  • 793
  • 1
  • 11
  • 20
5
votes
0 answers

Android Wear OS application vibration sometimes doesn't work

I am developing an Android Wear OS 2.0 application. Every time a user gets an SMS from a given number, the watch should start vibrating, and a UI with a given text should appear, with a button, which stops the vibration. It works in the following…
adamb
  • 793
  • 1
  • 11
  • 20
5
votes
2 answers

how to get the default vibration pattern of an android device?

I am creating an app for Android API 23, and I want to get the default vibration pattern that is used when the phone rings? I have this so far: Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); long[] pattern = {0, 500,…
zola
  • 5,737
  • 8
  • 33
  • 48
5
votes
1 answer

What is the shortest duration Vibrator.vibrate() can be called with where the device will still vibrate?

100 milliseconds works, but was too long of a vibration for my requirement. 50 milliseconds works and gives me what I want 10 milliseconds didn't work on my device This made me curious, is there a guarantee that 50ms will work on all devices? Is…
Captain Kirk
  • 350
  • 6
  • 24
5
votes
2 answers

Vibrate Not working with Notification

I am trying to set vibrate and sound for notification. For some reason its not working for me :( Here is the code what I am trying NotificationManager notificationManager = getNotificationManager(); NotificationCompat.Builder builder = new…
Achayan
  • 5,720
  • 2
  • 39
  • 61
5
votes
2 answers

Confused about haptic feedback in Android

I have an Android app with 9 buttons. This app runs on 2.36 and is the only app on the device (or at least the only app we let the user use - we ship the device with our code preinstalled as part of a suite of industrial products we sell.) All the…
user316117
  • 7,971
  • 20
  • 83
  • 158
5
votes
2 answers

android - shake detection

I use this good library for detect shake motion on android devices. Everything is good! But on my phone (Sony Xperia P) receiving SMS cause my phone to vibrate and shake detected! In some other phone like HTC Sensation XE, the problem doesn't…
Hossein
  • 933
  • 2
  • 9
  • 21
1
2
3
13 14