mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Pause download service if no network (#783)
* Add setupTableDrawerAdapter() function to simply KiwixMobileActivity.onCreate(). BUG: #565 * Pause DownloadService if network is not available * Revert changes to KiwixMobileActivity.java * Negation on the network availability condition. (cherry picked from commit 873218352f083c9d5dd2eff2f8cb597b52c33dbc)
This commit is contained in:
parent
10fdfc6f96
commit
97afab67db
@ -142,8 +142,7 @@ public class DownloadService extends Service {
|
|||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
String log = intent.getAction();
|
String log = intent.getAction() + " : ";
|
||||||
log += " : ";
|
|
||||||
if (intent.hasExtra(NOTIFICATION_ID)) {
|
if (intent.hasExtra(NOTIFICATION_ID)) {
|
||||||
log += intent.getIntExtra(NOTIFICATION_ID, -3);
|
log += intent.getIntExtra(NOTIFICATION_ID, -3);
|
||||||
}
|
}
|
||||||
@ -567,7 +566,8 @@ public class DownloadService extends Service {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MainActivity.wifiOnly && !NetworkUtils.isWiFi(getApplicationContext())) {
|
if (MainActivity.wifiOnly && !NetworkUtils.isWiFi(getApplicationContext()) ||
|
||||||
|
!NetworkUtils.isNetworkAvailable(getApplicationContext())) {
|
||||||
pauseDownload(chunk.getNotificationID());
|
pauseDownload(chunk.getNotificationID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user