简体   繁体   English

三星CUP如何使齿轮适应振动

[英]Samsung CUP how do I make the gear fit vibrate

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... 我正在使用android studio,很难发布任何内容...

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) 我要实现的目标是使用Samsung CUP SDK根据某些条件(例如,可能会在应用程序中或在应用程序外部设置的警报响起)在齿轮配合上导致长时间或连续振动模式通过意图调用了该应用程序(我想我会将此意图公开地公开给其他应用程序)

Anyways I just need some help getting the part where the gear fit vibrates with a vibration pattern (of my choice). 无论如何,我只需要一些帮助就可以使齿轮适合的零件以振动模式振动(由我选择)。

The ScupDialog class offers a method for vibration. ScupDialog类提供了一种振动方法。 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. 在应用程序的MainActivity中,您可以设置一个接收器,以接收您所指的警报。 Calling notifyEvent does vibration. 调用notifyEvent会振动。 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. 可能这并不是您要找的全部,但我希望它至少可以为您提供一个开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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