I'm trying to use the FirebaseJobDispatcher
for the first time and I got the code below from an example.
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
Job job = FirebaseJobDispatcher.newJobBuilder()
.setTag("testing job")
.setService(SmsDeleterJobService.class)
.setReplaceCurrent(true)
.setConstraints(Constraint.ON_ANY_NETWORK)
.build();
dispatcher.mustSchedule(job);
However Android studio has it underlined with the following message
Variable 'dispatcher' initializer 'new FirebaseJobDispatcher(new GooglePlayDriver(this))' is redundant less... (Ctrl+F1)
Inspection info: This inspection points out the cases where a variable value is never used after its assignment, i.e.: - the variable never gets read after assignment OR
- the value is always overwritten with another assignment before the next variable read OR - the variable initializer is redundant (for one of the above two reasons)
I looked at a few examples and they were all like this. What am I doing wrong?