Vibrate for milliseconds - Android Hardware

Android examples for Hardware:Vibrator

Description

Vibrate for milliseconds

Demo Code


//package com.java2s;

import android.app.Service;
import android.content.Context;

import android.os.Vibrator;

public class Main {

    public static void Vibrate(Context context, long milliseconds) {
        Vibrator vib = (Vibrator) context
                .getSystemService(Service.VIBRATOR_SERVICE);
        vib.vibrate(milliseconds);/*from  w w w . jav  a 2 s. co  m*/
    }
}

Related Tutorials