Make Your Android Phone Vibrate

By yinrow | May 3, 2009

So I got this good suggestion from one user’s comment: when shake to shuffle, make the phone vibrate.
It’s actually a very simple 2-step operation, but android developer site wasn’t very clear about. Here’s how I did it:

Add permission in AndroidManifest.xml file like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.VIBRATE" />
……
</manifest>

In your program when you want the phone to vibrate:

// [...]

How to detect shake motion on Android phone

By yinrow | Apr 13, 2009

When I was implementing the shake-to-shuffle feature in Pair-Up game, I googled for a similar code-snippet but didn’t have much luck. Eventually I came across this hidden code in Android Developer Guide which talks about using the phone motion sensor to program:
http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/os/Sensors.html
Alas! It can be done! But I just need a very simple function to [...]

© 2007 - 2009 ClingMarks