Is it possible to run accelerometer of iPhone in background?

穿精又带淫゛_ 提交于 2020-01-11 15:31:10

问题


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?


回答1:


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.




回答2:


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.




回答3:


No, it is presently not possible, at least if you want to distribute your application through the App Store.



来源:https://stackoverflow.com/questions/2294985/is-it-possible-to-run-accelerometer-of-iphone-in-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!