0

I want to make an application which when it is on "idle state" it must stop doing something. Application enters in idle when user doesn't interact with the application for a number of seconds (ex. 50). Are there some android classes for this or how to do this in a simpler way?

4

2 回答 2

2

当用户在几秒钟内没有与应用程序交互时,应用程序进入空闲状态(例如 50)

除了设备进入睡眠模式外,Android 中没有内置的“空闲”概念。您可以观看ACTION_SCREEN_OFF广播Intents,但这将适用于整个系统,而不仅仅是您的应用程序。

于 2011-04-11T13:26:29.813 回答
1

如果你没有“后台”任务处理,那你真的要了解 Android Activity 的生命周期。您不必关心您的应用程序是否“空闲”。您必须始终牢记,您的应用程序可以随时被系统置于睡眠状态。

认真阅读开发者指南。

于 2011-04-11T14:41:19.637 回答