EyeGesture和EyeGestureManager需要清晰 [英] EyeGesture and EyeGestureManager clarity needed

查看:171
本文介绍了EyeGesture和EyeGestureManager需要清晰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌审查小组要求glassewares为:

Google review team requires glassewares to:

调暗画面如果没有一个期望,用户是
  寻找吧。

Dim the screen if there isn't an expectation that a user is looking at it.

这是在这里,现在的玻璃的经验相一致。
  玻璃器皿应始终昏暗的屏幕,如果没有一个期望
  一个用户正在寻找它。理想的情况下,它的行为像一个时间表,并
  15秒后变暗。用户可以'rewake屏幕通过的查找

This is consistent with the "in the here and now" experience of Glass. Glassware should always dim the screen if there isn't an expectation that a user is looking at it. Ideally it behaves like a timeline and dims after 15s. A user can 'rewake' the screen by looking up.

更新:如果用户的不看结果中的设置
  卡滚动,屏幕变暗。

Update to be made: If a user is not looking at the results set in the card scroller, dim the screen.

这暗示使用 EyeGesture ,这似乎并没有要对的玻璃开发网页

This hints at using the EyeGesture, which doesn't seem to be mentioned anywhere on the Glass Develop Page.

在一些搜索,我发现这EyeGesture库(github上)从<一个href=\"http://stackoverflow.com/questions/27214236/google-glass-eye-gesture-crashing-eyegesturelib/27255824#27255824\">this计算器后(谷歌玻璃眼的手势崩溃(EyeGestureLib))似乎不能再工作(并没有4个月内被更新+)。

After some searching I found this EyeGesture library (github) that from this stackoverflow post (Google Glass Eye Gesture Crashing (EyeGestureLib)) doesn't seem to work anymore (and hasn't been updated in 4 months+).

使用这个修订EyeGesture库(github上)提出的接受的答案(来自计算器后)

也有人(在计算器后 - 为注释)提到:

It was also mentioned (in the stackoverflow post - as a comment ) that:

基本上,你试图揭露存在于玻璃类
  环境本身,但不是通过官方的API。通过声明
  这些存根类(均未的方法实施),并通过
  把它们放入com.google.android.glass.eye包,我们
  让我们的code与这些未实现类编译。在
  运行时,该系统具有这些类和的实现
  应用程序将改用系统的实现。

Basically, you're trying to expose classes that exist in the Glass environment itself, but not through the official APIs. By declaring these stub classes (none of the methods are implemented) and by putting them into the com.google.android.glass.eye package, we're allowing our code to compile with these unimplemented classes. At runtime, the system has implementations of those classes and the application will instead use the system's implementations.

这里是我下面的问题:


  1. 会不会有(何时)为EyeGesture的任何时候offcial API快?

  2. 我试着按照指导实施修订EyeGesture库到我的活动提出没有任何运气。什么可能我是做错了?

  3. 有我丢失的东西才能被检测到?我知道,与 GestureDetector 我需要覆盖 onGenericMotionEvent(MotionEvent事件),是那里的EyeGesture相似的地方?

  1. Will there be (and when) an offcial API for EyeGesture's any time soon?
  2. I tried Implementing the revised EyeGesture library into my activity by following the guide proposed without any luck. What could I be doing wrong?
  3. Is there something I'm missing for it to be detected? I know that with the GestureDetector I'm required to Override the onGenericMotionEvent(MotionEvent event), is there something similar for the EyeGesture?

这是目前我在做什么:

我有一个名为包 com.google.android.glass ,并在这个包我有以下几点:

I have a package named com.google.android.glass and in this package I have the following:


  • EyeGesture 枚举实现Parcelable

  • EyeGestureManager

  • EyeGesture enum that implements Parcelable
  • EyeGestureManager class

我在主包:


  • GestureIds (这一次是不同的,它是一个公共类,而不是私人的github上)

  • GestureIds class (This one is different the github in that it's a public class and not private)

在我的活动我有:

private void createEyeGestureDetector(ResultActivity resultActivity) {
    final GestureIds gestureIds = new GestureIds();
    //The github guide didn't mention any class names for 
    //mEyeGestureManager and mEyeGestureListener .. so I added some..
    EyeGestureManager mEyeGestureManager = EyeGestureManager.from(resultActivity);
    EyeGestureManager.Listener mEyeGestureListener = new EyeGestureManager.Listener() {
        @Override
        public void onDetected(EyeGesture gesture) {
            Log.i("EyeGestureListener", "Gesture: " + gesture.getId());
            int id = gesture.getId();
            if(id == gestureIds.WINK_ID || id == gestureIds.DOUBLE_WINK_ID) {
                Log.d("EyeGesture", "Wink");
            } else if (id == gestureIds.BLINK_ID || id == gestureIds.DOUBLE_BLINK_ID){
                Log.d("EyeGesture", "Blink");
            } else if (id == gestureIds.LOOK_AT_SCREEN_ID || id == gestureIds.LOOK_AWAY_FROM_SCREEN_ID) {
                Log.d("EyeGesture", "Screen");
            }

        }
    };
}

在我的的onCreate 我有:

//..
super.onCreate(bundle);
createEyeGestureDetector(this);
//..

更新logcat的:

当我做的:

for (EyeGesture eg : EyeGesture.values()) {
    boolean supported = mEyeGestureManager.isSupported(eg);
    Log.w("yupyup", eg.name() + ":" + supported);
}

我得到:

12-10 18:40:51.252    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ WINK:true
12-10 18:40:51.252    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ DOUBLE_WINK:false
12-10 18:40:51.252    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ BLINK:false
12-10 18:40:51.252    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ DOUBLE_BLINK:true
12-10 18:40:51.260    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ DON:true
12-10 18:40:51.268    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ DOFF:true
12-10 18:40:51.268    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ LOOK_AT_SCREEN:true
12-10 18:40:51.268    2405-2405/com.google.android.glass.websurg.websurg W/yupyup﹕ LOOK_AWAY_FROM_SCREEN:false

我还增加(从第一个GitHub的链接):

I also added (from the first github link):

@Override
protected void onStart(){
    super.onStart();
    createEyeGestureDetector(this);
    for (EyeGesture eg : EyeGesture.values()) {
        boolean supported = mEyeGestureManager.isSupported(eg);
        Log.w("yupyup", eg.name() + ":" + supported);
    }
    mEyeGestureManager.register(EyeGesture.LOOK_AT_SCREEN, mEyeGestureListener);
    mEyeGestureManager.register(EyeGesture.LOOK_AWAY_FROM_SCREEN, mEyeGestureListener);
    mEyeGestureManager.register(EyeGesture.WINK, mEyeGestureListener);

}

@Override
protected void onStop(){
    mEyeGestureManager.unregister(EyeGesture.LOOK_AT_SCREEN, mEyeGestureListener);
    mEyeGestureManager.unregister(EyeGesture.LOOK_AWAY_FROM_SCREEN, mEyeGestureListener);
    mEyeGestureManager.unregister(EyeGesture.WINK, mEyeGestureListener);
    super.onStop();
}

这给了我:

12-10 18:46:11.314    2553-2553/com.google.android.glass.websurg.websurg I/EyeGestureManager﹕ Removing listener: com.google.android.glass.websurg.websurg.ResultActivity$1@41b8b908 for eye gesture: LOOK_AT_SCREEN
12-10 18:46:11.314    2553-2553/com.google.android.glass.websurg.websurg I/EyeGestureManager﹕ Removing listener: com.google.android.glass.websurg.websurg.ResultActivity$1@41b8b908 for eye gesture: LOOK_AWAY_FROM_SCREEN
12-10 18:46:11.314    2553-2553/com.google.android.glass.websurg.websurg I/EyeGestureManager﹕ Removing listener: com.google.android.glass.websurg.websurg.ResultActivity$1@41b8b908 for eye gesture: WINK

但他们没有得到检测..甚至WINK因为它似乎得到支持。

However they do not get detected.. even the WINK since it seems to be supported.

推荐答案

谷歌团队已经回答了其中的一些,但我会继续前进,提供了有关他们的回答更多的细节,也提供了做这些东西你要求的另一种方式。

Google team already answered some of these but I will go ahead and provide more details about their answer and also provide an alternate way of doing these stuff you requested.

屏幕变暗,如果没有一个期望,一个用户正在查看
  吧。

Dim the screen if there isn't an expectation that a user is looking at it.

这是在这里,现在的玻璃的经验相一致。
  玻璃器皿应始终昏暗的屏幕,如果没有一个期望
  一个用户正在寻找它。理想的情况下,它的行为像一个时间表,并
  15秒后变暗。用户可以重新唤醒屏幕通过查找。

This is consistent with the "in the here and now" experience of Glass. Glassware should always dim the screen if there isn't an expectation that a user is looking at it. Ideally it behaves like a timeline and dims after 15s. A user can 're-wake' the screen by looking up.

更新:如果用户不看着在设定的结果
  卡滚动,屏幕变暗。

Update to be made: If a user is not looking at the results set in the card scroller, dim the screen.

玻璃处理本身,但问题是,如果用户的不会碰到玻璃垫的有关的 10秒以上的,玻璃将进入睡眠状态,你的应用程序将停止运行。
解决这个伟大的方法是使玻璃屏幕始终,并检查当用户看屏幕或当他们去掉玻璃。

Glass handles that itself but the problem is that if the user doesn't touch the Glass pad for about 10 seconds or more, Glass will go to sleep and your App will stop running. Great way of fixing this is to make Glass screen always on and check when the user looks at the screen or when they remove the Glass.

如果用户看着屏幕,增加画面的亮度,如果他们看远,降低画面的亮度。

If the user looks at the screen, increase the brightness of the screen, if they look away, decrease the brightness of the screen.

如果他们从脸上取下玻璃,降低亮度到零,关闭屏幕,并停止运行所有的大型CPU密集型code你有。

If they remove the Glass from their face, decrease the brightness to zero, turn off the screen and stop running all the big CPU intensive code you have.

如果他们把后面的玻璃上自己的脸,增加屏幕的亮度,打开屏幕,然后启用所有CPU密集型code。

If they put back the Glass on their face, increase the brightness of the screen,turn on the Screen and then enable all your CPU intensive code.

您可以只是一个布尔变量来确定何时启动或停止运行。建议使用此方法,如果您不希望您的应用程序停止秒内没有触摸事件之后运行。运行你的应用程序时,也可以节省电池。

You could just have a boolean variable to determine when to start or stop running. This method is recommended if you don't want your app to stop running after no touch event for seconds. It also saves battery when running your app.

$因为我上面说的事情C $ C的例程如下:

Code Examples for the things I said above are below:

要获取屏幕亮度:

//Get Screen Brightness
    public float getScreenBrightness() {
       WindowManager.LayoutParams wMLayout = getWindow().getAttributes();
       return  wMLayout.screenBrightness;
    }

要设置屏幕亮度(0〜1):

To Set Screen Brightness(0 to 1):

 //Set Screen Brightness
    public boolean setScreenBrightness(float sBrightness){
        if(sBrightness>=0){
            WindowManager.LayoutParams wMLayout = getWindow().getAttributes();
            wMLayout.screenBrightness = sBrightness; //Modify Brightness
            getWindow().setAttributes(wMLayout); //Apply changes
            return true;
        }else
        {
            return false;
        }
    }

要保持屏幕开启或关闭:

To Keep the Screen On or Off:

    //Turn Screen On/Off
public void keepScreenOn(boolean screenOn){
    if(screenOn) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }else{
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
}

不要forgeet在清单中添加permision:

Don't forgeet to add permision in the Manifest:

<uses-permission android:name="android.permission.WAKE_LOCK" />

如果你只是在做开发,不想现在就担心permision,你可以使用:

If you are just doing developing and don't want to worry about permision right now, you can use:

<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />

和避免查找什么许可使用。我建议你​​使用现在,因为它会在开发过程中节省您的时间和你没有编码的时候不用担心许可。

and avoid having to look up what permission to use. I suggest you use that for now as it will save you time during development and you don't have to worry about permission when coding.

[EYE GESTURE]

可用于检测那些没有谷歌官方的API。任何可用现在是一个小黑客来访问隐藏的玻璃API为。玻璃团队正在努力就可以了,他们说,当它是可靠的API将只释放。现在,它根据对他们来说是不完美的。

No Google official API available for detecting those. Anything available now is a little hack to access hidden Glass API for that. Glass team is working on it and they said the API will only be release when it is reliable. Right now, it is NOT perfect according to them.

注:

NOTE

我对下面张贴应该工作,但可能不会在下次更新玻璃工作答案。当他们这样做的更新,一些神奇的变化和一个功能将停止工作。玻璃API和玻璃本身是测试模式,因此预计直到官方EYE手势API被释放的事情不断变化。

The answer I am about to post below SHOULD work but may NOT work on the next Glass update. When they do update, something magically changes and one function will STOP working. Glass API and Glass itself is on Beta Mode and therefore expect things to keep changing until official EYE Gesture API gets released.

有两种方法来检测眼睛手势。一种方法是使用的IntentFilter和等待的手势message.Another方式是使用存根库访问隐藏的玻璃的API。我就说说都在这里,因为有prons和缺点每个方法。

There are two ways to detect Eye Gesture. One way is to use IntentFilter and wait for "gesture" message.Another way is to use Stub Library to Access the hidden Glass API. I will talk about both here as there are prons and cons for each method.

方法1(存根库):

这是当前正在试图做到这一点的方式。

This is the way you are currently trying to do it.

赞成

可检测的更多手势

缺点

眨眼的无法从拍照弯腰。

Wink CANNOT be stooped from taking pictures.

呦使用不同的库比我使用的是仍在工作的人。我会尽量解决您的问题,如果不工作,那么你应该做的我做了矿用我以前太图书馆该怎么走。

Yo are using different library than the one I used that is still working. I will try to fix your problem if that doesn't work, You should then do it the way I did mine with the library I used too.

您得到了第1步错了。

第1步:创建存根:

创建一个名为com.google.android.glass包。在这个包
  创建两个类:EyeGesture和EyeGestureManager

Create a package called com.google.android.glass. In this package create two classes: EyeGesture and EyeGestureManager

这应该是

com.google.android.glass.eye

com.google.android.glass.eye

NOT

com.google.android.glass

com.google.android.glass

com.google.android.glass 可能在过去的工作,但有太多的更新。

com.google.android.glass may have worked in the past but there were too many updates.

所以,EyeGesture和EyeGestureManager必须被放置在你的包名为 com.google.android.glass.eye

So, EyeGesture and EyeGestureManager must be placed in your package called com.google.android.glass.eye

如果仍没有检测到眼睛的姿态,忘记该库,并使用我目前使用的人。关闭项目,创建一个新的。

If Eye gesture is still not detected, forget about that library and use the one I am currently using. Close your project and create a new one.

步骤:

1)下载从图书馆这里。 (最后更新时间为4个月前)。您当前所使用的可能是过去8个月前更新甚至一年前。

1) Download the library from here. (Last update was 4 months ago). The one you are currently using was probably last updated 8 months ago or even a year ago.

https://github.com/prt2121/EyeGestureLib

该zip文件将有很长的名字,如 EyeGestureLib-fwenindioniwenubwudew

The zip file will have a long name like "EyeGestureLib-fwenindioniwenubwudew".

重命名Zip文件为 EyeGestureLib

Rename the Zip file to "EyeGestureLib".

用长名称,如提取里面的文件夹 EyeGestureLib-f8a9fef3bde4396f947106e78cd0be7c7ecdd5a6

Extract the folder inside with a long name like "EyeGestureLib-f8a9fef3bde4396f947106e78cd0be7c7ecdd5a6"

重命名文件夹 EyeGestureLib

Rename that folder to "EyeGestureLib"

在EyeGestureLib文件夹中应该有两个文件夹里面所谓的 EyeGestureStub EyeGestureDemoApp 加上其他无用的文件。

The "EyeGestureLib" folder should have two folders inside it called "EyeGestureStub" and "EyeGestureDemoApp" plus other useless files.

2)打开Eclipse,并创建一个新项目。
创建一个简单的MainActivty类的活动。

2) Open Eclipse and create a new project. create a simple MainActivty class activity.

3)内您的 MainActivity 类:

private EyeGestureManager mEyeGestureManager;
private EyeGestureListener mEyeGestureListener;

private EyeGesture target1 = EyeGesture.WINK;
private EyeGesture target2 = EyeGesture.DOUBLE_BLINK;
private EyeGesture target3 = EyeGesture.LOOK_AT_SCREEN;

的onCreate

mEyeGestureManager = EyeGestureManager.from(this);
mEyeGestureListener = new EyeGestureListener();

在onStart

mEyeGestureManager.register(target1, mEyeGestureListener);
mEyeGestureManager.register(target2, mEyeGestureListener);
mEyeGestureManager.register(target3, mEyeGestureListener);

的onStop

mEyeGestureManager.unregister(target1, mEyeGestureListener);
mEyeGestureManager.unregister(target2, mEyeGestureListener);
mEyeGestureManager.unregister(target3, mEyeGestureListener);

MainActivity (里面没有任何功能,而是随便找个地方里面你MainActivity类别):

Inside MainActivity (Not inside any function but just anywhere inside you MainActivity class):

private class EyeGestureListener implements Listener {

    @Override
    public void onEnableStateChange(EyeGesture eyeGesture, boolean paramBoolean) {

    }

    @Override
    public void onDetected(final EyeGesture eyeGesture) {
       //Show what we just detected
       Log.i(eyeGesture.toString() , " is detected");

              //Check which eye event occured
        if (eyeGesture.name() == target1.name()) {
            // Wink
            Log.i("EyeGesture: ", " you just winked");
        } else if (eyeGesture.name() == target2.name()) {
            // Double blink
            Log.i("EyeGesture: ", " you just double winked");
        } else if (eyeGesture.name() == target3.name()) {
            // Look at Screen
            Log.i("EyeGesture: ", " you Looked at Screen");
        }

    }
}

4)您会得到错误。
导入的 EyeGestureStub 那是在 EyeGestureLib 文件夹里面的修复

4) You will get error. Import the EyeGestureStub that is inside the EyeGestureLib folder to fix it.

要修复错误:

转到文件 - > 导入 - > Android的 - > 现有的Andr​​oid code到工作区

点击下一步 浏览并浏览里面的 EyeGestureStub 文件夹 EyeGestureLib 文件夹中。

Click Next, Browse and Browse the EyeGestureStub folder inside EyeGestureLib folder.

确认排除 EyeGestureDemoApp 如果它是存在的。您需要的 EyeGestureLib 文件夹包含 EyeGesture EyeGestureManager

Make sure to exclude the "EyeGestureDemoApp" if it is there. You ONLY need EyeGestureLib folder which contains EyeGesture and EyeGestureManager.

B)右键点击 EyeGestureStub - > 属性 - > 的Andr​​oid - >
在右侧,在项目建设目标确保 玻璃开发工具包preVIEW 入住箱检查

b) Right click on "EyeGestureStub" -> Properties -> Android -> On the right side,under Project Build Target make sure that "Glass Development Kit Preview" check-box is checked.

图书馆,确保了 是库复选框为检查

Under Library, make sure that the "Is Library" check-box is checked.

点击应用确定以退出窗口。

C)打开 Android SDK中经理即可。检查安装的Andr​​oid SDK中内建工具版本。我有21.1.1。

c) Open Android SDK Manger. check for the version of Android SDK Build-tools installed. I have 21.1.1.

D)打开 project.properties 的的 EyeGestureStub 并变更 sdk.buildtools = 18.1 .1 sdk.buildtools = 21.1.1
完成

d) Open the project.properties of EyeGestureStub and change sdk.buildtools=18.1.1 to sdk.buildtools=21.1.1 Finish.

完成。它,如果你依照指示应该工作。

Done. It should work if you followed the instruction.

运行,并选择 MainActivity 作为在启动活动

Run it and choose MainActivity as the the Launch Activity.

<-------------------------------------------------------------------------------------------------------------------------------->

[仍无法正常工作?导入所有&放大器;&安培;从那里工作]

[STILL NOT WORKING? IMPORT EVERYTHING && work from there]

如果你不能得到它的工作,删除当前项目并导入下载然后从那里工作了整个项目。这是最简单的方法。您可能需要修正一些错误,你可以编译之前。**

If you can't get it to Work, delete the current project and import the whole project downloaded then work from there up. This is the easiest way. You may need to fix some errors before you can compile.**

要导入项目,

1)转到文件 - > 其他 - > Android的 - > Android项目从现有code

下一步 - > 浏览

然后选择 EyeGestureLib 文件夹,其中包含两个 EyeGestureStub EyeGestureDemoApp

then choose the EyeGestureLib folder which contains both the EyeGestureStub and EyeGestureDemoApp.

项目一定要导入两个 EyeGestureStub EyeGestureDemoApp 是复选框被选中,然后点击完成

2)右键点击 EyeGestureStub - > 属性 - > 的Andr​​oid - >
在右侧,在项目建设目标确保 玻璃开发工具包preVIEW 入住箱检查

2) Right click on "EyeGestureStub" -> Properties -> Android -> On the right side,under Project Build Target make sure that "Glass Development Kit Preview" check-box is checked.

图书馆,确保了 是库复选框为检查

Under Library, make sure that the "Is Library" check-box is checked.

点击应用确定以退出窗口。

3)右键点击 MainActivity - > 属性 - > 的Andr​​oid - >
在右侧,在项目建设目标确保 玻璃开发工具包preVIEW 入住箱检查

3) Right click on "MainActivity" -> Properties -> Android -> On the right side,under Project Build Target make sure that "Glass Development Kit Preview" check-box is checked.

4)您将得到不会被显示无形的错误。

4) You will get invisible error that will not be showing.

要看到它转到窗口 - > 显示视图 - > 问题
   在那里,你会看到所有的问题。

To see it Go to Windows -> Show View -> Problems There, you will see all the problems.

下一步要解决它,我们必须符合 Android SDK中构建的工具版本在 project.properties <列出的/ EM> EyeGestureStub MainActivity

Next step to fix it, we have to match the Android SDK Build-tools version with the ones listed in the project.properties of both EyeGestureStub and MainActivity

打开 Android SDK中经理即可。检查安装的Andr​​oid SDK中内建工具版本。我有21.1.1。

a) Open Android SDK Manger. check for the version of Android SDK Build-tools installed. I have 21.1.1.

B)打开 project.properties 的的 EyeGestureStub 并变更 sdk.buildtools = 18.1 .1 sdk.buildtools = 21.1.1

b) Open the project.properties of EyeGestureStub and change sdk.buildtools=18.1.1 to sdk.buildtools=21.1.1

C)打开 project.properties 的的 MainActivity 并变更 sdk.buildtools = 18.1 .1 sdk.buildtools = 21.1.1

c) Open the project.properties of MainActivity and change sdk.buildtools=18.1.1 to sdk.buildtools=21.1.1

注意:更改第一project.properties可能会自动改变第二个。

Note: Changing the first project.properties may automatically change the second one.

完成。它,如果你依照指示应该工作。

Done. It should work if you followed the instruction.

运行,并选择 MainActivity 作为在启动活动

Run it and choose MainActivity as the the Launch Activity.

<-------------------------------------------------------------------------------------------------------------------------------->

方法2(IntentFilter的)

赞成

眨眼的可以从拍照停止。

Wink CAN be stopped from taking pictures.

缺点

检测 WINK ONLY

Detects WINK ONLY

第一种方法可以接收四个事件(WINK,DOUBLE_WINK,DOUBLE_BLINK,LOOK_AT_SCREEN,)但是这种方法的只有收到一个事件( WINK )。

The first method can receive four events (WINK,DOUBLE_WINK,DOUBLE_BLINK,LOOK_AT_SCREEN,) but this method can ONLY receive one event (WINK).

如果你只是想发现这种方法非常有用的只有 WINK 无玻璃拍照。

This method is useful if you just want to detect ONLY WINK without Glass taking a picture.

要听意图,你必须扩展广播接收器。

To listen to Intent, you have to extend BroadcastReceiver.

public class EyeGesture extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getStringExtra("gesture").equals("WINK")) {

             //Disable Camera Snapshot
            abortBroadcast();

            Log.e("WINKED ","");
        }else {
            Log.e("SOMETHING", "is detected " + intent.getStringExtra("gesture"));
        }
    }
}

您必须注册在清单如下意图:

You must register the intent in the Manifest as below:

 <receiver android:name="com.inno.inno.glassplugin.EyeGesture">
                <intent-filter>
                    <action android:name="com.google.android.glass.action.EYE_GESTURE" />
                </intent-filter>
 </receiver>

在指定的名称在清单必须与类听力的名称是意图相匹配的 EyeGesture

The name specified in the Manifest must match the name of the class listening to the intent which is EyeGesture.

就这么简单。不需要库,但只WINK可以检测。这也从检测到眨眼时拍照停止玻璃。你可以发表评论 abortBroadcast(); 如果你想检测到事件时玻璃进行拍照。

Simple as that. No library required but only WINK can be detected. It also stops Glass from taking picture when wink is detected. You can comment abortBroadcast(); if you want Glass to take picture when event is detected.

这是对于任何一个希望在这一刻从玻璃检测眼睛的手势。这些都是围绕着目前唯一的解决方案,直到谷歌发布自己的官方眼睛手势API。

This is for any one looking to detect Eye Gesture from Glass at this moment. These are the only current solutions around until Google releases their official Eye Gesture API.

您应该提交一个新的玻璃API功能这里 。把它作为玻璃眼睛手势API请求即可。如果玻璃团队收到太多了此功能的要求,他们将使他们的首要任务,然后松开。我已经申请了的。

You should file for a new Glass API feature here. File it as Glass Eye Gesture API Request. If the Glass team receives too much of this feature request, they will make it their top priority and release it. I already filed for one.

这篇关于EyeGesture和EyeGestureManager需要清晰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆