简体   繁体   中英

Is it possible to turn vibration on/off on Sony Smartwatch 2 (by application)?

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 )

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM