How to check if vibration happened, in logcat?

后端 未结 1 813
夕颜
夕颜 2021-01-20 16:47

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 p

相关标签:
1条回答
  • 2021-01-20 17:21

    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 讨论(0)
提交回复
热议问题