2015年7月26日 星期日

[Android] Vibrate 振動實作

Sometime we need to let the phone vibrate when receive a message or something happen
我們現在來進行實做 "振動" 這項功能
  Vibrator myVibrator = (Vibrator) getApplication().getSystemService(Service.VIBRATOR_SERVICE);
  myVibrator.vibrate(1000);//millisecond

Don't forget to add in your AndroidManifest.xml!!!!!
<uses-permission android:name="android.permission.VIBRATE" />

沒有留言:

張貼留言