In firebase Job dispatcher can be detected when we connect to the network, but how to determine when we disconnect from the network?
Job myJob = dispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag("my-unique-tag")
.setConstraints(
Constraint.ON_UNMETERED_NETWORK,
Constraint.DEVICE_CHARGING
)
.build();
dispatcher.mustSchedule(myJob);
This will be detected when connecting to a non-routed network, I want to start the service when it is disconnected from all networks.
source
share