aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-17 13:09:02 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-17 13:09:02 +0200
commit0605390144b85dfe3531ad47cfa276f9f5c8ba5b (patch)
treec05fbb7eb88f9dbb541ae91684060d59621afeed /src/eu/siacs/conversations/services/XmppConnectionService.java
parent3372e50155ac16c9eabce9a484914c2acbf391c8 (diff)
do not attempt to download images when not connected
Diffstat (limited to 'src/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java20
1 files changed, 11 insertions, 9 deletions
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