diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-17 13:09:02 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-17 13:09:02 +0200 |
commit | 0605390144b85dfe3531ad47cfa276f9f5c8ba5b (patch) | |
tree | c05fbb7eb88f9dbb541ae91684060d59621afeed /src/eu/siacs/conversations/services | |
parent | 3372e50155ac16c9eabce9a484914c2acbf391c8 (diff) |
do not attempt to download images when not connected
Diffstat (limited to 'src/eu/siacs/conversations/services')
-rw-r--r-- | src/eu/siacs/conversations/services/NotificationService.java | 2 | ||||
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/services/NotificationService.java b/src/eu/siacs/conversations/services/NotificationService.java index 1983e581..0b30e58e 100644 --- a/src/eu/siacs/conversations/services/NotificationService.java +++ b/src/eu/siacs/conversations/services/NotificationService.java @@ -13,12 +13,10 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.PowerManager; -import android.os.SystemClock; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; import android.text.Html; -import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 4a680228..36ea350b 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -346,15 +346,10 @@ public class XmppConnectionService extends Service { } } this.wakeLock.acquire(); - ConnectivityManager cm = (ConnectivityManager) getApplicationContext() - .getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); - boolean isConnected = activeNetwork != null - && activeNetwork.isConnected(); - + for (Account account : accounts) { if (!account.isOptionSet(Account.OPTION_DISABLED)) { - if (!isConnected) { + if (!hasInternetConnection()) { account.setStatus(Account.STATUS_NO_INTERNET); if (statusListener != null) { statusListener.onStatusChanged(account); @@ -412,6 +407,13 @@ public class XmppConnectionService extends Service { } return START_STICKY; } + + public boolean hasInternetConnection() { + ConnectivityManager cm = (ConnectivityManager) getApplicationContext() + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + return activeNetwork != null && activeNetwork.isConnected(); + } @SuppressLint("TrulyRandom") @Override @@ -1873,8 +1875,8 @@ public class XmppConnectionService extends Service { private class DeletedDownloadable implements Downloadable { @Override - public void start() { - return; + public boolean start() { + return false; } @Override |