Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我应该在应用程序中实现空闲时间备份功能。任何人都可以帮助我提供任何示例代码或参考资料。
上述功能的一个用例是备份联系人、日历。主要我需要实现空闲时间备份。
假设您的意思是当您的应用程序空闲而不是手机空闲时:
当您的应用程序空闲时使用AlarmManager在特定延迟后开始备份。
如果您的应用在警报触发之前重新启动,请取消警报。
OnPauseActivity 的和onResume方法可用于确定应用程序何时空闲。
OnPause
onResume