为什么我不能使用Sensor.TYPE_TILT_DETECTOR?

3

在我的应用中,我需要检测用户何时倾斜设备(左或右)。

在Android源代码中,有一个倾斜检测器

    /**
     * A sensor of this type generates an event each time a tilt event is detected. A tilt event
     * is generated if the direction of the 2-seconds window average gravity changed by at
     * least 35 degrees since the activation of the sensor. It is a wake up sensor.
     *
     * @hide
     * @see #isWakeUpSensor()
     */
    public static final int TYPE_TILT_DETECTOR = 22;

然而,它有一个@hide注释,所以我不能使用它。这个SO的答案说:

顺便说一下,Sensor.TYPE_TILT_DETECTOR等是在SDK中隐藏的,因为它们只用于系统UI。

这真的很烦人,因为它似乎正是我需要的功能。我们不能使用它的任何原因吗?我真的必须重新发明轮子吗?

我有同样的问题 - Jeffrey Liu
1个回答

0

很遗憾只能使用数字22。我也遇到了同样的问题,但数字22对我有效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接