我有一项需要执行互联网的任务,必须每天无限期执行,下面是我为执行相同操作而编写的代码
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
Job myJob = dispatcher.newJobBuilder()
.setService(FirebaseJobDispatcherService.class) // the JobService that will be called
.setTag(Constants.ALERT_TAG) // uniquely identifies the job
.setRecurring(true)
.setLifetime(Lifetime.FOREVER)
.setReplaceCurrent(true)
.setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
.setTrigger(Trigger.executionWindow(0, (int) TimeUnit.DAYS.toSeconds(1)))
.setConstraints(Constraint.ON_ANY_NETWORK)
.build();
dispatcher.mustSchedule(myJob);
Run Code Online (Sandbox Code Playgroud)
现在的问题是,它可以在像Moto,三星等普通设备上正常工作,但在像OnePlus这样的自定义ROM上,小米只有在应用程序打开时才会触发作业.有没有人遇到这个问题或者知道如何使它在自定义ROM上正常工作?
每次在recyclerview中更新图像列表时都会出现轻微的图像闪烁,我在GridView中面临同样的问题,这是通过在这样的持有者中设置图像url的标记来解决的,
//for solving image flicker
if(contentViewHolder.ivPhoto.getTag()==null || (!contentViewHolder.ivPhoto.getTag().equals(currentMoment.getThumbnailUrl()))){
mImageLoader.displayImage(currentMoment.getThumbnailUrl(), contentViewHolder.ivPhoto);
}
contentViewHolder.ivPhoto.setTag(currentMoment.getThumbnailUrl());
Run Code Online (Sandbox Code Playgroud)
这在gridview中工作得很好,但是在回收者视图的情况下它没有解决图像闪烁,有人可以建议我如何在回收者视图的情况下停止图像闪烁吗?