如何检查是否发生了震动,在logcat的? [英] How to check if vibration happened, in logcat?

查看:189
本文介绍了如何检查是否发生了震动,在logcat的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在搜索网络,但我couldn找到一个单一的文章中直接的方式处理如何找到在logcat的开/关日志的震动。如果有人谁知道程序的,请赐教。再一次,我需要它专门检查,如果我的应用程序触发振动器或不...

I searched in the web but i couldn find a single article dealing in a straight forward way on how to find the vibrate on/off logs in logcat. If anybody who is aware of the procedure, please enlighten me. Once again i need it specifically to check if my app triggers vibrator or not...

推荐答案

振动数据默认情况下不记录。幸运的是,有一些code在<一个href=\"http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=services/java/com/android/server/HardwareService.java;h=88074c2c59eab371b5d3022dc6c90bb187df1d7c;hb=HEAD\"相对=nofollow> HardwareServices.java 可以启用提供正是你想要的。请记住,因为这是框架的一部分,改变它会要求你重建,并刷新您的设备。如果你是在一个ADP或模拟器中运行这个应该很容易。如果你这样做是另一台设备上,可能会有点更具挑战性。

Vibration data is not logged by default. Fortunately, there is some code in HardwareServices.java that can be enabled to provide exactly what you want. Keep in mind that since this is part of the framework, changing it will require you to rebuild and reflash your device. If you are running on an ADP or the emulator this should be easy. It might be a bit more challenging if you are doing this on another device.

找到以下code和替换真正,你应该准备就绪。

Locate the following code and replace false with true and you should be all set.

        if (false) {
            String s = "";
            int N = pattern.length;
            for (int i=0; i<N; i++) {
                s += " " + pattern[i];
            }
            Log.i(TAG, "vibrating with pattern: " + s);
        }

这篇关于如何检查是否发生了震动,在logcat的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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