I want to enable/disable vibration on Sony Smartwatch 2 in my app on some conditions.
Is it possible and if it so how to do that?
EDIT: I mean enable/disable it globally (notifications, incoming calls etc.), as "Vibrate" setting in SW2 menu.
I want to enable/disable vibration on Sony Smartwatch 2 in my app on some conditions.
Is it possible and if it so how to do that?
EDIT: I mean enable/disable it globally (notifications, incoming calls etc.), as "Vibrate" setting in SW2 menu.
You might not be able to do this globally.
From the docs, the watch operates on actions from the host.
I don't have a SW2 right now but you can try to trigger the extension when you detect the device is vibrating.
This would be a start:
public class NoVibrator extends ControlExtension{
// stuff....
@Override
public void onStart() {
if(hasVibrator()){
stopVibrator();
}
}
}
But I suspect this only disables vibration in your app.
You might have to find an exploit to change the settings. (something like this)
stopVibrator()
just makes vibrator active for some amount of time. It seems that this method can only interrupt vibration with infinite repeats (and only between iterations of on/off cycle). Anyway, thanks for response. –
Actinal I don't know what your conditions are but to control the vibration use these methods in the ControlExtension class:
Start:
ControlExtension.startVibrator(int onDuration, int offDuration, int repeats);
Stop:
ControlExtension.stopVibrator();
Edit 1: There is no way to configure vibration for notifications.
© 2022 - 2024 — McMap. All rights reserved.
Vibrator
is absolutely not that I need. I need to turn vibration on/off globally, likeAudioManager.setVibrateSetting
but on SW2. This question is about Sony API, rather than Android API. – Actinal