Does anyone know how I will wake up the Wear screen? I am running the vibration API with:
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate( getResources().getInteger( R.integer.vibration_duration ) );
which should stop after 2 seconds (2000 milliseconds). This works great if the screen is on, but if the screen is off, the vibration will continue until the screen touches and wakes up.
Edit: I put together a quick hack so that it works with a timer, but I would like it to be able to stop the vibration in a cleaner way.
final Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate( getResources().getInteger( R.integer.vibration_duration ) ); Timer timer = new Timer(); timer.schedule( new TimerTask() { @Override public void run() { v.cancel(); } }, getResources().getInteger( R.integer.vibration_duration ) );
Reedit: It doesn't work every time, soooo yes, being able to wake up the screen would be a better choice. I got it to work using the template instead of directly entering the time, but I still would like to know how to activate the screen, since I feel that this can cause more problems as I continue to work with this platform.
long[] pattern = { 0, getResources().getInteger( R.integer.vibration_duration ) }; v.vibrate( pattern, -1 );
source share