I am running this on button click in my android app:
public void vibrateold() {
Vibrator vibrate = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
vibrate.vibrate(4000);
}
But the vibration doesn't stop when leaving the activity before 4 seconds.How should I stop it ?
How about the Vibrators method cancel()?
For example: (Initialize and start vibrating in the onCreate() - if the activity is destroyed or paused before the 10 seconds of vibration run out, stop vibrating)