iPhone的加速度计可以在后台运行吗?
我想使用iPhone的加速度计来获取加速度计值的日志文件(可能是24小时)。当其他应用程序运行时,是否可以让加速度计在后台运行?
I want to use accelerometer of iPhone to get the log file of accelerometer value (maybe for 24 hours). Is it possible to let accelerometer runs in background while other applications are running?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的应用程序因其他原因被允许在后台运行,您现在就可以执行此操作。请参阅 Core Motion API 的
startAccelerometerUpdatesToQueue:withHandler:
方法 此处。You can do it now, if your app is allowed to run in the background for other reasons. See the Core Motion API's
startAccelerometerUpdatesToQueue:withHandler:
method here.不,事实并非如此。除了在后台运行音乐应用程序外,您基本上无法运行任何其他程序。
不过,您可以在手机暂停时运行加速度计。
请参阅此博客了解如何操作: http://marcopeluso.com/2009/08/23/how-to-prevent-iphone-from-deep-sleeping/
我在我的 GPS 记录应用程序中使用了这种技术。
Nope, it is not. You basically can't run anything but a music app in the background.
You can run the accelerometer while the phone is suspended though.
See this blog for how to do it: http://marcopeluso.com/2009/08/23/how-to-prevent-iphone-from-deep-sleeping/
I use this technique in my GPS recording app.
不,目前不可能,至少如果您想通过 App Store 分发您的应用程序。
No, it is presently not possible, at least if you want to distribute your application through the App Store.