Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make the wearable vibrate from within an android wear app [closed]

I'm writing a simple wearable app to my LG watch that sends vibrations to the watch on constant intervals and show some mock data.

Although I've looked for an answer, I could't find a way to make the watch vibrate. Any help would be appriciated.

like image 311
Jacob Avatar asked Oct 04 '14 11:10

Jacob


People also ask

Why does my smart watch not vibrate?

If the watch does not vibrate when it's supposed to, make sure watch only mode is turned off, and check the vibrate option for Bluetooth disconnection alerts and notifications. However, if the problem continues, inspect the watch for physical damages.

How do I turn off vibrate on wear OS?

On your phone, launch the Galaxy Wearable app. Go to Watch settings > Sounds and vibration. You can select from three modes—Sound, Vibrate, and Mute.


1 Answers

@Drew, thank you!

If anyone else is interested, here's a code snippet to demonstrate a vibration on your watch:

  • Add the following line to your AndroidManifest.xml:

    <uses-permission android:name="android.permission.VIBRATE"/>
    
  • In your code:

            Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
            long[] vibrationPattern = {0, 500, 50, 300};
            //-1 - don't repeat
            final int indexInPatternToRepeat = -1;
            vibrator.vibrate(vibrationPattern, indexInPatternToRepeat);
    
like image 162
Jacob Avatar answered Oct 15 '22 02:10

Jacob