Может быть сделано. Что именно вы ищете? Процедура загрузки или как сделать проверку?
Вот метод загрузки, вы должны запустить его в AsyncTask или около того.
/**
* Downloads a remote file and stores it locally
* @param from Remote URL of the file to download
* @param to Local path where to store the file
* @throws Exception Read/write exception
*/
static private void downloadFile(String from, String to) throws Exception {
HttpURLConnection conn = (HttpURLConnection)new URL(from).openConnection();
conn.setDoInput(true);
conn.setConnectTimeout(10000); // timeout 10 secs
conn.connect();
InputStream input = conn.getInputStream();
FileOutputStream fOut = new FileOutputStream(to);
int byteCount = 0;
byte[] buffer = new byte[4096];
int bytesRead = -1;
while ((bytesRead = input.read(buffer)) != -1) {
fOut.write(buffer, 0, bytesRead);
byteCount += bytesRead;
}
fOut.flush();
fOut.close();
}
Вы также можете проверить, подключен ли телефон хотя бы к WiFi (и 3G);
// check for wifi or 3g
ConnectivityManager mgrConn = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
TelephonyManager mgrTel = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if ((mgrConn.getActiveNetworkInfo()!=null && mgrConn.getActiveNetworkInfo().getState()==NetworkInfo.State.CONNECTED)
|| mgrTel.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS) {
...
в противном случае люди разозлятся, когда им потребуется загрузить 100 м по медленной телефонной сети.