X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d54345d0403a4ea2214b793b24ba0e821ea1339c..c0a3399573c9b10cf4729ae02070003932ecf884:/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java diff --git a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java index c1c3e9ca..400a6de3 100644 --- a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java +++ b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java @@ -1,6 +1,8 @@ -/* ownCloud Android client application +/** + * ownCloud Android client application + * * Copyright (C) 2012 Bartek Przybylski - * Copyright (C) 2012-2014 ownCloud Inc. + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -87,7 +89,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { Account account = AccountUtils.getCurrentOwnCloudAccount(context); if (account == null) { - Log_OC.w(TAG, "No owncloud account found for instant upload, aborting"); + Log_OC.w(TAG, "No ownCloud account found for instant upload, aborting"); return; } @@ -175,12 +177,27 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { return; } + if (instantPictureUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context)){ + Account account = AccountUtils.getCurrentOwnCloudAccount(context); + if (account == null) { + Log_OC.w(TAG, "No owncloud account found for instant upload, aborting"); + return; + } + + Intent i = new Intent(context, FileUploader.class); + i.putExtra(FileUploader.KEY_ACCOUNT, account); + i.putExtra(FileUploader.KEY_CANCEL_ALL, true); + context.startService(i); + } + if (!intent.hasExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY) && isOnline(context) && (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))) { DbHandler db = new DbHandler(context); Cursor c = db.getAwaitingFiles(); - if (c.moveToFirst()) { + if (c.moveToFirst() && isOnline(context) + && (!instantPictureUploadViaWiFiOnly(context) || + (instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))) { do { String account_name = c.getString(c.getColumnIndex("account")); String file_path = c.getString(c.getColumnIndex("path"));