JobManager.create() will take much time
See original GitHub issueHi,
If I add below JobManager.create() codes in Application.onCreate(), StrictMode$StrictModeDiskReadViolation warning is showed in log.
JobManager.create(this).addJobCreator(MyJobCreator())
06-05 17:27:36.740 25915-25915/? D/StrictMode: StrictMode policy violation; ~duration=106 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65567 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249) at java.io.File.exists(File.java:780) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:541) at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:497) at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:656) at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:374) at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:171) at com.evernote.android.job.JobStorage.<init>(JobStorage.java:123) at com.evernote.android.job.JobStorage.<init>(JobStorage.java:119) at com.evernote.android.job.JobManager.<init>(JobManager.java:155) at com.evernote.android.job.JobManager.create(JobManager.java:112)
Calling JobManager.create() in Application.onCreate() may influence app launching time. May I call JobManager.create() in second thread?
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top GitHub Comments
Hi! We’re also seeing a lot of ANRs when creating the JobManager. Like this:
at com.evernote.android.job.JobManager.<init> (JobManager.java:149) at com.evernote.android.job.JobManager.create (JobManager.java:102)
How come this has to be done on the main thread?
@vRallev How do we know, from the public API point of view, which ones involve IO/Network work that must be done in the background thread?