<uses-permission androidname="android.permission.VIBRATE"/>
アクティビティでVibratorを取得
import android.os.Vibrator;
public class MainActivity extends Activity {
private Vibrator vib;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
vib = (Vibrator)getSystemService(VIBRATOR_SERVICE);
}
Vibratorを使用
vib.vibrate(5000);
long pattern[] = {0, 500, 500, 500, 1000, 500, 500, 500};
vib.vibrate(pattern, -1);
vib.vibrate(pattern, 0);
vib.vibrate(pattern, 2);
vib.cancel();