Refactoring

pull/147/head
M66B 6 years ago
parent 245ce11e21
commit 4706b58232

@ -2518,26 +2518,26 @@ public class ServiceSynchronize extends LifecycleService {
private ExecutorService queue = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
@Override
public void onCapabilitiesChanged(Network network, NetworkCapabilities capabilities) {
public void onAvailable(Network network) {
try {
if (!started) {
EntityLog.log(ServiceSynchronize.this, "Network " + network + " capabilities " + capabilities);
if (suitableNetwork())
queue_reload(true, "connect " + network);
}
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
EntityLog.log(ServiceSynchronize.this, "Available " + network + " " + cm.getNetworkInfo(network));
if (!started && suitableNetwork())
queue_reload(true, "connect " + network);
} catch (Throwable ex) {
Log.e(ex);
}
}
@Override
public void onAvailable(Network network) {
public void onCapabilitiesChanged(Network network, NetworkCapabilities capabilities) {
try {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
EntityLog.log(ServiceSynchronize.this, "Available " + network + " " + cm.getNetworkInfo(network));
if (!started && suitableNetwork())
queue_reload(true, "connect " + network);
if (!started) {
EntityLog.log(ServiceSynchronize.this, "Network " + network + " capabilities " + capabilities);
if (suitableNetwork())
queue_reload(true, "connect " + network);
}
} catch (Throwable ex) {
Log.e(ex);
}

Loading…
Cancel
Save