Android Tutorial 60 - Vibrating your Phone

Published: 25 March 2014
on channel: Code Here Now
4,443
20

This is an excerpt from Learn by Doing - Android for Beginners on Udemy.
https://www.udemy.com/learn-by-doing-...

Video shows you how to use your device's vibrator.

Things to Remember
-----------------------------
1. You need to declare the android.permission.VIBRATE permission in the manifest to use the vibrator.

2. Get an instance of the Vibrator by calling the Context.getSystemService(Context.VIBRATOR_SERVICE).

3. To vibrate the device for a specific duration call the Vibrator.vibrate(long) method.

4. To vibrate the device in a specific pattern call the Vibrator.vibrate(long[], int) method.

5. To stop the device from vibrating, call the Vibrator.cancel() method.

6. Also make sure that you call Vibrator.cancel() by overriding the onPause() method inside your Activity.


Watch video Android Tutorial 60 - Vibrating your Phone online without registration, duration hours minute second in high quality. This video was added by user Code Here Now 25 March 2014, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,443 once and liked it 20 people.