如何在后台或睡眠模式采样加速度计数据

编程入门 行业动态 更新时间:2024-10-24 18:29:13
本文介绍了如何在后台或睡眠模式采样加速度计数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个计划,将采样加速计数据所有的时间,做了一些分析。但我发现,当pressing电源按钮或在睡眠模式下,系统不会在一段时间后采样数据。是否有人知道如何让加速度运行在后台收集数据?

I have a program which will sample accelerometer data all the time and do some analysis. But I find that when pressing the power button or in the sleep mode, the system will not sample data after a period of time. Does anybody know how to let accelerometer run in the background to collect data?

非常感谢!

推荐答案

您需要设置一个PARTIAL_WAKE_LOCK将保持CPU运行,仍然允许在屏幕熄灭。当然,电池会更快耗尽。

You'll need to set a PARTIAL_WAKE_LOCK which will keep the CPU running and still allow the screen to go off. Of course, the battery will run down faster.

的developer.android/reference/android/os/PowerManager.html#PARTIAL_WAKE_LOCK

更多推荐

如何在后台或睡眠模式采样加速度计数据

本文发布于:2023-11-27 10:12:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637649.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加速度计   后台   睡眠   模式   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!