安排特定日期的任务&安卓中的时间 [英] Schedule task for a specific date & time in android

查看:55
本文介绍了安排特定日期的任务&安卓中的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我准备执行应用程序计划任务,例如 4 月 28 日凌晨 5 点我需要检查服务器上的文件,例如应用程序是否有更新.但是如果用户当时他的手机关机,则需要在可能的最佳时间执行任务,下次启动时需要执行任务.当手机连接到互联网时?

I'm tying to make a app schedules task, for example 28th of april at 5am I need to check a file on my server, for example if there is a Update for the app. But if the user his phone is shutdown at that time the task needs to be executed at the best time possible, next bootup & when the phone is conencted to the internet?

我不知道如何做到这一点?我在 Android API 中找不到可以在 android 中执行此任务的框架或类.

I can't figure out how I can do this? I can't find a framework or Classes in the Android API that can do This task in android.

有谁知道这样做的方法以及性能和电池的最佳方法是什么?

Anyone who knows a way to do this and what the best way is for performance, battery?

推荐答案

这个问题是教程比较好解决的类型;我建议查看 AlarmManager 文档,甚至查看第 26 章:背景The Big Nerd Ranch 上的服务:Android 编程指南;如果不是,关于如何创建闹钟应用程序的简单教程可能会有所帮助.

This question is the type that is better solved by a tutorial; I would suggest looking into the AlarmManager documentation and even checking chapter 26: Background Services on The Big Nerd Ranch: Android Programming Guide; if not maybe a simple tutorial on how to create an alarm clock app might help.

这篇关于安排特定日期的任务&安卓中的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆