1
我使用Evernote的Android Job庫。版本1.2.0。Android Job庫DailyJob是否啓動Application類onCreate?
對於日常工作中我使用DailyJob(https://evernote.github.io/android-job/javadoc/com/evernote/android/job/DailyJob.html)這樣的:
public class DailySyncJob extends DailyJob {
public static final String TAG = "DailySyncJob";
public static void schedule() {
if (!JobManager.instance().getAllJobRequestsForTag(TAG).isEmpty()) {
// job already scheduled, nothing to do
return;
}
JobRequest.Builder builder = new JobRequest.Builder(TAG).setRequiredNetworkType(JobRequest.NetworkType.UNMETERED);
// run job between 11pm and 6am
DailyJob.schedule(builder, TimeUnit.HOURS.toMillis(23), TimeUnit.HOURS.toMillis(6));
}
@NonNull
@Override
protected DailyJobResult onRunDailyJob(Params params) {
// do something
return DailyJobResult.SUCCESS;
}
}
是否onRunDailyJob
啓動一個應用程序類的onCreate()?
基於文檔我並不完全清楚,但日常工作基於'WorkerThread'和'PowerManager.WakeLock',您可能想更新問題以包含該問題,這可能有助於某人回答基於瞭解這些。 –