黑莓磁力计方向 - 哪个方向?
我目前正在尝试使用新的 BlackBerry 磁力计 API 但不幸的是我遇到了各种问题。我已经让磁力计工作了,但我无法从中获得可靠的结果。
在 iPhone 指南针上,如果您将手机的顶部朝向天空,或者将手机的屏幕朝向天空,您会在指南针上得到相同的读数。但是,在 BlackBerry 上,磁力计数据这让我很困惑。
据我所知, getDirectionTop 返回手机背面平放时的角度, getDirectionBack 返回手机顶部朝向天空时的角度。
有没有办法根据手机方向获取方向?例如,自动检测手机是平放还是直立,并据此得到所需的方向?
I am currently trying to use the new BlackBerry Magnetometer API but am unfortunately coming up against various issues. I have got the magnetometer working but I can't get reliable results from it.
On the iPhone compass, if you hold the phone with its top facing the sky, or if you hold the phone with its screen facing the sky, you get the same readings on the compass. However, on BlackBerry there are various directions given by the MagnetometerData which confuse me.
As far as I can tell getDirectionTop returns the angle when the phone is flat on its back and getDirectionBack returns the angle when the phone is being held with its top to the sky.
Is there a way to get the direction based on the phones orientation? For example, automatically detect if the phone is flat or upright and get the required direction based on that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然可以,通过 加速度计 API< /a>.
Sure, via the accelerometer API.