android - 加速仅在调试时有效

发布于 2024-12-13 02:05:52 字数 126 浏览 2 评论 0原文

我有一个应用程序可以记录手机的加速度并将其保存到文件中。 当我在手机上以调试模式检查应用程序时,一切都运行良好。 当我获取 apk 文件并将其安装到手机上时,该应用程序不保存任何加速?

这是为什么?

谢谢!

I have an app that records the phone's accelerations and saves them to a file.
When I check the app in debug mode on my phone, everything works great.
When I take the apk file and install it one the phone, the app dose'nt saves any accelerations?

Why is that?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸短情长 2024-12-20 02:05:52

发现问题了。
当我调试代码(服务)时,我使用了 android.os.Debug.waitForDebugger(); 以便我可以调试代码。
在发布模式下,这一行似乎会阻止其后面的代码。
我删除了线,问题就解决了。

Found the problem.
When I debugged my code (service) I used android.os.Debug.waitForDebugger(); so I can debug the code.
It seems that this line blocks the code after it while in release mode.
I removed the line and the problem solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文