开发者

How to check if vibration happened, in logcat?

开发者 https://www.devze.com 2023-01-03 09:23 出处:网络
I searched in the web but i couldn find a single article deali开发者_Python百科ng in a straight forward way on how to find the vibrate on/off logs in logcat. If anybody who is aware of the procedure,

I searched in the web but i couldn find a single article deali开发者_Python百科ng 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...


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.

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);
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消