Code example for Vibrator

Methods: toString, vibrate

0
 
        // Check that the phone wont vibrate if the user is on the phone 
        if (((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)).getCallState() ==
                TelephonyManager.CALL_STATE_IDLE){
            vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
            vibrator.vibrate(vibratePattern, 0);
            Log.v(TAG, "Vibrator says:" + vibrator.toString());
        } 
    } 
 
    /** 
     * User pressed the dismiss button. We call finish and set the result intent. 
     */ 
    private void dismiss() { 
        wasDismissed = true;
        if (PreferenceService.getShowSleepData(this)) {
            Intent myIntent = new Intent(this, SleepInfoActivity.class);
            myIntent.putExtra("showFeelings", true);
            startActivity(myIntent);
        } 
        finish();