use of android.os.Vibrator in project android_frameworks_base by AOSPA.
the class BugreportProgressService method takeScreenshot.
/**
* Takes a screenshot and save it to the given location.
*/
private static boolean takeScreenshot(Context context, String path) {
final Bitmap bitmap = Screenshooter.takeScreenshot();
if (bitmap == null) {
return false;
}
boolean status;
try (final FileOutputStream fos = new FileOutputStream(path)) {
if (bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos)) {
((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE)).vibrate(150);
return true;
} else {
Log.e(TAG, "Failed to save screenshot on " + path);
}
} catch (IOException e) {
Log.e(TAG, "Failed to save screenshot on " + path, e);
return false;
} finally {
bitmap.recycle();
}
return false;
}
use of android.os.Vibrator in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method vibrate.
private void vibrate() {
try {
Vibrator v = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(200);
} catch (Exception e) {
e.printStackTrace();
}
}
use of android.os.Vibrator in project HAR-Android by linw7.
the class BeeAndVibrateManager method vibrate.
/**
* @param context Context实例
* @param milliseconds 震动时长 , 单位毫秒
*/
public static void vibrate(Context context, long milliseconds) {
Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
vib.vibrate(milliseconds);
}
use of android.os.Vibrator in project xDrip by NightscoutFoundation.
the class JoH method vibrateNotice.
public static void vibrateNotice() {
final Vibrator vibrator = (Vibrator) xdrip.getAppContext().getSystemService(VIBRATOR_SERVICE);
long[] vibrationPattern = { 0, 500, 50, 300 };
final int indexInPatternToRepeat = -1;
vibrator.vibrate(vibrationPattern, indexInPatternToRepeat);
}
use of android.os.Vibrator in project Signal-Android by signalapp.
the class ConversationActivity method onRecorderStarted.
@Override
public void onRecorderStarted() {
Vibrator vibrator = ServiceUtil.getVibrator(this);
vibrator.vibrate(20);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
audioRecorder.startRecording();
}
Aggregations