Logout on previous network

pull/187/head
M66B 4 years ago
parent 80a00b157d
commit 94340307c4

@ -2004,8 +2004,18 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
} }
if (!Objects.equals(lastActive, active)) { if (!Objects.equals(lastActive, active)) {
if (lastActive != null) if (lastActive != null) {
lastLost = new Date().getTime(); boolean connected = false;
try {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = (cm == null ? null : cm.getNetworkInfo(lastActive));
connected = (ni != null && ni.isConnected());
} catch (Throwable ex) {
Log.e(ex);
}
if (!connected)
lastLost = new Date().getTime();
}
lastActive = active; lastActive = active;
EntityLog.log(ServiceSynchronize.this, "New active network=" + active); EntityLog.log(ServiceSynchronize.this, "New active network=" + active);

Loading…
Cancel
Save