<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.noshufou.android.su.RESPOND" />
<string name="su_not_updated">An error occurred and su was not updated. A zip file (su-2.3.1-bin-signed.zip) has been placed on your sdcard, please reboot into recovery mode and flash it to update your su binary.</string>
<string name="su_up_to_date">su is up to date</string>
<string name="checking">Checking...</string>
+ <string name="no_connection">No network connection. Could not check for updates</string>
<string name="tab_apps">Apps</string>
<string name="tab_log">Log</string>
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.Build.VERSION;
}
public void doUpdate() {
- // Get the process started, it all goes from here.
- new DownloadFileTask().execute("http://dl.dropbox.com/u/6408470/Superuser/manifest.json");
+ ConnectivityManager cm =
+ (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (cm.getActiveNetworkInfo() == null
+ || cm.getActiveNetworkInfo().getState() == NetworkInfo.State.DISCONNECTED) {
+ Toast.makeText(mContext, R.string.no_connection, Toast.LENGTH_SHORT).show();
+ } else {
+ // Get the process started, it all goes from here.
+ new DownloadFileTask().execute("http://dl.dropbox.com/u/6408470/Superuser/manifest.json");
+ }
}
private void postManifest() {