aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/UpdaterActivity.java20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
index bed5ed26b..3893f7b7b 100644
--- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
@@ -11,8 +11,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -30,6 +28,7 @@ import java.io.File;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.services.UpdaterWebService;
+import de.pixart.messenger.services.XmppConnectionService;
public class UpdaterActivity extends Activity {
@@ -39,6 +38,7 @@ public class UpdaterActivity extends Activity {
private DownloadManager downloadManager;
private long downloadReference;
private String FileName = "update.apk";
+ private XmppConnectionService mXmppConnectionService;
BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
@@ -79,7 +79,7 @@ public class UpdaterActivity extends Activity {
registerReceiver(downloadReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
//check of internet is available before making a web service request
- if (isNetworkAvailable(this)) {
+ if (isNetworkAvailable()) {
Intent msgIntent = new Intent(this, UpdaterWebService.class);
msgIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
msgIntent.putExtra(UpdaterWebService.REQUEST_STRING, Config.UPDATE_URL);
@@ -112,16 +112,10 @@ public class UpdaterActivity extends Activity {
}
//check for internet connection
- private boolean isNetworkAvailable(Context context) {
- ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (connectivity != null) {
- NetworkInfo[] info = connectivity.getAllNetworkInfo();
- if (info != null) {
- for (int i = 0; i < info.length; i++) {
- if (info[i].getState() == NetworkInfo.State.CONNECTED) {
- return true;
- }
- }
+ private boolean isNetworkAvailable() {
+ if (mXmppConnectionService.hasInternetConnection()) {
+ if (mXmppConnectionService.isWIFI() || mXmppConnectionService.isMobile()) {
+ return true;
}
}
return false;