android - 加速仅在调试时有效
我有一个应用程序可以记录手机的加速度并将其保存到文件中。 当我在手机上以调试模式检查应用程序时,一切都运行良好。 当我获取 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现问题了。
当我调试代码(服务)时,我使用了 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.