Added logging

pull/178/head
M66B 5 years ago
parent bea4dc52b0
commit 254364d29a

@ -1599,7 +1599,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
private ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(@NonNull Network network) {
EntityLog.log(ServiceSynchronize.this, "Available network=" + network);
try {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getNetworkInfo(network);
EntityLog.log(ServiceSynchronize.this, "Available network=" + network + " info=" + ni);
} catch (Throwable ex) {
Log.w(ex);
}
updateState(network, null);
}
@ -1612,9 +1618,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
public void onLost(@NonNull Network network) {
try {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo active = cm.getActiveNetworkInfo();
EntityLog.log(ServiceSynchronize.this, "Lost network=" + network + " active=" + active);
if (active == null)
NetworkInfo ani = cm.getActiveNetworkInfo();
EntityLog.log(ServiceSynchronize.this, "Lost network=" + network + " active=" + ani);
if (ani == null)
lastLost = new Date().getTime();
} catch (Throwable ex) {
Log.w(ex);

Loading…
Cancel
Save