Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Licensed Materials - Property of IBM
 *  Copyright IBM Corporation 2014, 2015. All Rights Reserved.
 */

import android.content.Context;

import android.os.Vibrator;

public class Main {
    /**
     * Vibrates the phone for the desired number of milliseconds. Ensure that the vibration
     * permission is listed in the app's manifest file.
     *
     * @param context
     * @param milliseconds The number of milliseconds to vibrate the phone for
     */
    public static void vibratePhone(Context context, long milliseconds) {
        Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
        vibrator.vibrate(milliseconds);
    }
}