Armin
Armin

Reputation: 1837

Rotarty (ring) on Samsung Tizen Gear S2

I have been trying to make use of the rotary (ring) of the Gear S2 on my Tizen web apps.

I did not find any part of the documentation giving a direct example anywhere. How can we make use of the rotary?

Upvotes: 0

Views: 486

Answers (1)

Armin
Armin

Reputation: 1837

After reading the Tizen Advanced UI Javascript code, I found what I was looking for.

To simply use the rotary of the S2, please use the following code snippet:

rotaryDetentCallback = function rotaryDetentHandler(e) {
    var direction = e.detail.direction;
    if (direction === "CW") {
        // TODO: do something when rotated clockwise

    } else if (direction === "CCW") {
        // TODO: do something when rotated counter clockwise

    }
};

window.addEventListener("rotarydetent", rotaryDetentCallback);

I hope this will help other fellow developers who are also looking everywhere trying to find it.

Upvotes: 2

Related Questions