mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-24 16:53:37 +00:00
Logout on previous network
This commit is contained in:
parent
80a00b157d
commit
94340307c4
1 changed files with 12 additions and 2 deletions
|
@ -2004,8 +2004,18 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
}
|
||||
|
||||
if (!Objects.equals(lastActive, active)) {
|
||||
if (lastActive != null)
|
||||
lastLost = new Date().getTime();
|
||||
if (lastActive != null) {
|
||||
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;
|
||||
EntityLog.log(ServiceSynchronize.this, "New active network=" + active);
|
||||
|
|
Loading…
Reference in a new issue