gpt4 book ai didi

android - 无法更改 Google Play 服务 Activity 识别的请求间隔

转载 作者:行者123 更新时间:2023-11-29 00:23:38 24 4
gpt4 key购买 nike

如标题所述,我的问题是无法正确控制 Activity 识别请求。我的代码是这样的:

arclient.requestActivityUpdates(ACTIVITY_DETECT_INTERVAL, pIntent);

ACTIVITY_DETECT_INTERVAL =2*60*1000(2 分钟)

但是日志显示

01-27 12:21:49.412: I/ActivityRecognitionService(5458): Still   92
01-27 12:21:54.462: I/ActivityRecognitionService(5458): Still 92
01-27 12:21:59.492: I/ActivityRecognitionService(5458): Still 69
01-27 12:22:04.562: I/ActivityRecognitionService(5458): Still 76
01-27 12:22:09.662: I/ActivityRecognitionService(5458): Still 76
01-27 12:22:14.592: I/ActivityRecognitionService(5458): Still 92
01-27 12:22:19.612: I/ActivityRecognitionService(5458): Still 77
01-27 12:22:24.622: I/ActivityRecognitionService(5458): Still 92
01-27 12:22:29.672: I/ActivityRecognitionService(5458): Still 92
01-27 12:22:34.892: I/ActivityRecognitionService(5458): Still 85
01-27 12:22:39.812: I/ActivityRecognitionService(5458): Still 92

原来间隔总是 5 秒。谁能帮帮我,先谢谢了。

最佳答案

根据 requestActivityUpdates documentation :

Activities may be received more frequently than the detectionIntervalMillis parameter if another application has also requested activity updates at a faster rate. It may also receive updates faster when the activity detection service receives a signal that the current activity may change, such as if the device has been still for a long period of time and is then unplugged from a phone charger.

您当然可以在您自己的应用程序中过滤掉事件(假设您存储上次收到事件的时间,然后忽略从那时到该时间之后 2 分钟之间的事件),但是无法限制传入 Activity 的数量更新超出您手机上最耗电的应用程序请求或您的请求,无论哪个更大。

关于android - 无法更改 Google Play 服务 Activity 识别的请求间隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21373107/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com