Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

vibration android studio

import android.os.Vibrator;
...
// Pause for 500ms, vibrate for 500ms, then start again
private static final long[] VIBRATE_PATTERN = { 500, 500 };

mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    // API 26 and above
    mVibrator.vibrate(VibrationEffect.createWaveform(VIBRATE_PATTERN, 0));
} else {
    // Below API 26
    mVibrator.vibrate(VIBRATE_PATTERN, 0);
}
Comment

vibration android studio

// Get instance of Vibrator from current Context
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

// Start without a delay
// Each element then alternates between vibrate, sleep, vibrate, sleep...
long[] pattern = {0, 100, 1000, 300, 200, 100, 500, 200, 100};

// The '-1' here means to vibrate once, as '-1' is out of bounds in the pattern array
v.vibrate(pattern, -1);
Comment

vibration android studio

// Get instance of Vibrator from current Context
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

// Start without a delay
// Vibrate for 100 milliseconds
// Sleep for 1000 milliseconds
long[] pattern = {0, 100, 1000};

// The '0' here means to repeat indefinitely
// '0' is actually the index at which the pattern keeps repeating from (the start)
// To repeat the pattern from any other point, you could increase the index, e.g. '1'
v.vibrate(pattern, 0);
Comment

PREVIOUS NEXT
Code Example
Java :: java reverse serach 
Java :: break statement in Java switch...case 
Java :: get value from dynamic input android 
Java :: Rotate Left k cells java 
Java :: bloomreach get node via id 
Java :: Java Arraylist bestimmtes element ausgeben 
Java :: android studio null 
Java :: how to check android version 9 above programatically 
Java :: java fx custom cell factory for combo box 
Java :: system.out.println(h [2] [1] [1] [0]); 
Java :: square operator java 
Java :: import claim jwt 
Java :: spring security specific url for specific account 
Java :: java 8 retrieve all list from object into single list and ignore duplicates 
Java :: struct in java 
Java :: fibonacci series 
Java :: convert kotlin to java online editor 
Java :: song listening app android 
Java :: convert kotlin to java online 
Java :: throw keyword in java 
Java :: Java if...else...if Statement 
Java :: java indexof not found 
Java :: Java getClass() method 
Java :: java how to write something on the console with scanner 
Java :: maven set repository location command line 
Java :: devotional meaning 
Java :: what is getService() in java 
Sql :: stop mysql service ubuntu 
Sql :: mysql get table size 
Sql :: how to get notinteger value in sql 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =