Search in sources :

Example 51 with Vibrator

use of android.os.Vibrator in project smartmodule by carozhu.

the class BeepManager method playBeepSoundAndVibrate.

/**
	 * 根据配置播放提示音和震动
	 */
public synchronized void playBeepSoundAndVibrate() {
    if (playBeep && mediaPlayer != null) {
        mediaPlayer.start();
    }
    if (vibrate) {
        Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE);
        vibrator.vibrate(VIBRATE_DURATION);
    }
}
Also used : Vibrator(android.os.Vibrator)

Example 52 with Vibrator

use of android.os.Vibrator in project coursera-android by aporter.

the class Receiver1 method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    Log.i(TAG, "INTENT RECEIVED");
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(500);
    Toast.makeText(context, "INTENT RECEIVED by Receiver1", Toast.LENGTH_LONG).show();
}
Also used : Vibrator(android.os.Vibrator)

Example 53 with Vibrator

use of android.os.Vibrator in project coursera-android by aporter.

the class Receiver2 method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    Log.i(TAG, "INTENT RECEIVED");
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(500);
    Toast.makeText(context, "INTENT RECEIVED by Receiver2", Toast.LENGTH_LONG).show();
}
Also used : Vibrator(android.os.Vibrator)

Example 54 with Vibrator

use of android.os.Vibrator in project coursera-android by aporter.

the class Receiver3 method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    Log.i(TAG, "INTENT RECEIVED");
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(500);
    Toast.makeText(context, "INTENT RECEIVED by Receiver3", Toast.LENGTH_LONG).show();
}
Also used : Vibrator(android.os.Vibrator)

Example 55 with Vibrator

use of android.os.Vibrator in project coursera-android by aporter.

the class Receiver2 method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    Log.i(TAG, "INTENT RECEIVED");
    Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(500);
    Toast.makeText(context, "INTENT RECEIVED by Receiver2", Toast.LENGTH_LONG).show();
}
Also used : Vibrator(android.os.Vibrator)

Aggregations

Vibrator (android.os.Vibrator)88 IOException (java.io.IOException)10 RemoteException (android.os.RemoteException)8 SettingNotFoundException (android.provider.Settings.SettingNotFoundException)6 InputDevice (android.view.InputDevice)6 NotificationManager (android.app.NotificationManager)5 Intent (android.content.Intent)5 Bitmap (android.graphics.Bitmap)5 SystemVibrator (android.os.SystemVibrator)5 FileOutputStream (java.io.FileOutputStream)5 Activity (android.app.Activity)4 Context (android.content.Context)4 AudioManager (android.media.AudioManager)4 PowerManager (android.os.PowerManager)4 NotificationCompat (android.support.v4.app.NotificationCompat)4 ErrnoException (android.system.ErrnoException)4 Uri (android.net.Uri)3 AlarmManager (android.app.AlarmManager)2 PendingIntent (android.app.PendingIntent)2 SearchManager (android.app.SearchManager)2