Added logging

This commit is contained in:
M66B 2020-03-28 08:05:01 +01:00
parent bea4dc52b0
commit 254364d29a
1 changed files with 10 additions and 4 deletions

View File

@ -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);