Samsung CUP how do I make the gear fit vibrate

985 Views Asked by At

How do I make the gear fit vibrate continously?

I used someone else's sample code and got this far

public class GearFitSDKSample extends ScupDialog {

    MyActivity activity;

    public GearFitSDKSample(Context context) {
        super(context);
        activity = (MyActivity) context;

        // TODO Auto-generated constructor stub
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        final ScupLabel label = new ScupLabel(this);
        label.setWidth(ScupLabel.FILL_DIALOG);
        label.setHeight(ScupLabel.FILL_DIALOG);
        label.setText("Hello XDA Developers!");
        label.show();
        setBackPressedListener(new BackPressedListener() {
            @Override
            public void onBackPressed(ScupDialog arg0) {
                finish();
            }
        });
    }

    public Integer x;

    {
        x = 50;
    }

    public Integer signo = 1;
}

I'm using android studio and having a hard time getting anything to post...

The goal i'm trying to achieve is use the Samsung CUP SDK to cause a long , or continuous vibration pattern on the gear fit based on some conditions such as possibly, an alarm going off which would be set in the app or outside it then have the app called through an intent (I would expose this intent to other apps publically I guess)

Anyways I just need some help getting the part where the gear fit vibrates with a vibration pattern (of my choice).

1

There are 1 best solutions below

0
On

The ScupDialog class offers a method for vibration. Parameter is a vibration pattern - from short to long. You could add the following method to your class above:

public void notifyEvent() {
    vibrate(ScupDialog.VIBRATION_TYPE_MID);
}

In your apps' MainActivity you may set up a receiver which receives the alarm you are referring to. Calling notifyEvent does vibration. Implementing a vibration pattern is more effort. You would need to call vibrate multiple times with delays in between. A loop that calls vibrate continuously should not be too long as the user may want to interrupt it.

Probably, this is not entirely what you are looking for, but I hope it at lest gives you a start.