diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3f89a39648..30aafcd835 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -225,7 +225,7 @@
MMS message encrypted for non-existing session...
- Currently unable to send your MMS message. It will be sent once service becomes available.
+ Currently unable to send your MMS message.
Import in progress
diff --git a/src/org/thoughtcrime/securesms/service/MmsDownloader.java b/src/org/thoughtcrime/securesms/service/MmsDownloader.java
index b6c2dcb2c7..7224ec0c4d 100644
--- a/src/org/thoughtcrime/securesms/service/MmsDownloader.java
+++ b/src/org/thoughtcrime/securesms/service/MmsDownloader.java
@@ -179,7 +179,7 @@ public class MmsDownloader extends MmscProcessor {
if (pendingMessages.isEmpty())
finishConnectivity();
- } else if (!isConnected() && !isConnectivityPossible()) {
+ } else if (!isConnected() && (!isConnectivityPossible() || isConnectivityFailure())) {
pendingMessages.clear();
handleDownloadError(downloadItems, MmsDatabase.Status.DOWNLOAD_NO_CONNECTIVITY,
context.getString(R.string.MmsDownloader_no_connectivity_available_for_mms_download_try_again_later));
diff --git a/src/org/thoughtcrime/securesms/service/MmsSender.java b/src/org/thoughtcrime/securesms/service/MmsSender.java
index bdeb527b8e..8dc3136008 100644
--- a/src/org/thoughtcrime/securesms/service/MmsSender.java
+++ b/src/org/thoughtcrime/securesms/service/MmsSender.java
@@ -170,7 +170,7 @@ public class MmsSender extends MmscProcessor {
protected void handleConnectivityChange() {
if (!isConnected()) {
- if (!isConnectivityPossible() && !pendingMessages.isEmpty()) {
+ if ((!isConnectivityPossible() || isConnectivityFailure()) && !pendingMessages.isEmpty()) {
DatabaseFactory.getMmsDatabase(context).markAsSentFailed(pendingMessages.remove().request.getDatabaseMessageId());
toastHandler.makeToast(context.getString(R.string.MmsSender_currently_unable_to_send_your_mms_message));
Log.w("MmsSender", "Unable to send MMS.");
diff --git a/src/org/thoughtcrime/securesms/service/MmscProcessor.java b/src/org/thoughtcrime/securesms/service/MmscProcessor.java
index 43a26c89ff..42ccbe3e07 100644
--- a/src/org/thoughtcrime/securesms/service/MmscProcessor.java
+++ b/src/org/thoughtcrime/securesms/service/MmscProcessor.java
@@ -66,6 +66,8 @@ public abstract class MmscProcessor {
protected void issueConnectivityRequest() {
int status = connectivityManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, FEATURE_ENABLE_MMS);
+ Log.w("MmscProcessor", "startUsingNetworkFeature status: " + status);
+
if (status == APN_ALREADY_ACTIVE) {
issueConnectivityChange();
} else if (connectivityListener == null) {
@@ -77,9 +79,17 @@ public abstract class MmscProcessor {
}
}
+ protected boolean isConnectivityFailure() {
+ NetworkInfo networkInfo = connectivityManager.getNetworkInfo(TYPE_MOBILE_MMS);
+
+ return networkInfo == null || networkInfo.getDetailedState() == NetworkInfo.DetailedState.FAILED;
+ }
+
+
protected boolean isConnectivityPossible() {
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(TYPE_MOBILE_MMS);
Log.w("MmsService", "Got network info: " + networkInfo);
+
return networkInfo != null && networkInfo.isAvailable();
}