简体   繁体   English

记录“ mEventCount =” @ HTC One M8

[英]Log “mEventCount = ” @ HTC One M8

I've tested my Android App with a Nexus 5 (4.4.4) and a HTC One M8 (4.4.4). 我已经用Nexus 5(4.4.4)和HTC One M8(4.4.4)测试了我的Android应用。 But only with the HTC One I'm getting logs on log level info like this: 但是,只有使用HTC One,我才能在日志级别的信息上获得日志,如下所示:

Application | TAG           | Text
<myapp>     | SensorManager | mEventCount = x

x is a increasing number. x是一个递增的数字。

I'm using the motion sensors in my app, but I don't like this counter in the logs. 我在应用中使用了运动传感器,但我不喜欢日志中的该计数器。 Do you guys have similar logs when you use the motion sensors with an HTC device? 当您将运动传感器与HTC设备一起使用时,你们有类似的日志吗?

Edit: I'm not 100% sure, but I think it has come with Android 4.4.4. 编辑:我不确定100%,但是我认为Android 4.4.4附带了它。

EDIT2: Here are some code fragments: EDIT2:这是一些代码片段:

private SensorManager sensorManager;
...
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  ...
  this.sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
  this.accelerometer = this.sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
  this.sensorManager.registerListener(this, this.accelerometer,
                    SensorManager.SENSOR_DELAY_GAME);
  ...
}

public void onSensorChanged(SensorEvent event) {
  switch (event.sensor.getType()) {
    case Sensor.TYPE_LINEAR_ACCELERATION:
      onAccelerationSensorChanged(event); break;
  ...
}

private void onAccelerationSensorChanged(SensorEvent event) {
  // save to Manager
  this.manager.setAcceleration(event.values[0], event.values[1], event.values[2]);
  // set some TextViews
  ...
}

I think it's the proper way to use the Motion Sensors. 我认为这是使用运动传感器的正确方法。 And the log messages doesn't appear at the Nexus 5. So I think it's a custom modification by HTC. 而且日志消息没有出现在Nexus 5上。所以我认为这是HTC的自定义修改。

由于我已将HTC更新为Android 5.0,因此此日志消息已消失。

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

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