diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
index 07ae14f42..2cc636e92 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
@@ -91,6 +91,7 @@ import eu.siacs.conversations.ui.util.IntroHelper;
import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.ui.util.UpdateHelper;
+import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.EmojiWrapper;
import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.MenuDoubleTabUtil;
@@ -105,6 +106,7 @@ import me.drakeet.support.toast.ToastCompat;
import static eu.siacs.conversations.ui.ConversationFragment.REQUEST_DECRYPT_PGP;
import static eu.siacs.conversations.ui.SettingsActivity.HIDE_MEMORY_WARNING;
+import static eu.siacs.conversations.ui.SettingsActivity.MIN_ANDROID_SDK21_SHOWN;
public class ConversationsActivity extends XmppActivity implements OnConversationSelected, OnConversationArchived, OnConversationsListItemUpdated, OnConversationRead, XmppConnectionService.OnAccountUpdate, XmppConnectionService.OnConversationUpdate, XmppConnectionService.OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoomDestroy {
@@ -277,11 +279,30 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
openBatteryOptimizationDialogIfNeeded();
new showMemoryWarning().execute();
+ showOutdatedVersionWarning();
}
}
+ private void showOutdatedVersionWarning() {
+ if (Compatibility.runsTwentyOne() || getPreferences().getBoolean(MIN_ANDROID_SDK21_SHOWN, false)) {
+ Log.d(Config.LOGTAG, "Device is running Android >= SDK 21");
+ return;
+ }
+ Log.d(Config.LOGTAG, "Device is running Android < SDK 21");
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.oldAndroidVersion);
+ builder.setMessage(R.string.oldAndroidVersionMessage);
+ builder.setPositiveButton(R.string.ok, (dialog, which) -> {
+ getPreferences().edit().putBoolean(MIN_ANDROID_SDK21_SHOWN, true).apply();
+ });
+ final AlertDialog dialog = builder.create();
+ dialog.setCanceledOnTouchOutside(false);
+ dialog.show();
+ }
+
private String getBatteryOptimizationPreferenceKey() {
- @SuppressLint("HardwareIds") String device = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
+ @SuppressLint("HardwareIds")
+ String device = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
return "show_battery_optimization" + (device == null ? "" : device);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index 3665b924c..8cb18add7 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -82,6 +82,7 @@ public class SettingsActivity extends XmppActivity implements
public static final String ALLOW_MESSAGE_CORRECTION = "allow_message_correction";
public static final String USE_UNICOLORED_CHATBG = "unicolored_chatbg";
public static final String EASY_DOWNLOADER = "easy_downloader";
+ public static final String MIN_ANDROID_SDK21_SHOWN = "min_android_sdk21_shown";
public static final int REQUEST_CREATE_BACKUP = 0xbf8701;
Preference multiAccountPreference;
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 4ea083e33..b69986ded 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -1119,4 +1119,6 @@
Your messenger is using %1$s (%2$s) of internal memory.\n\nYou can enable automatic message deletion in relation with automatic attachment deletion or delete stored media manually.
Your messenger is using %1$s (%2$s) of internal memory.\n\nYou should enable automatic message deletion in relation with automatic attachment deletion or delete stored media manually. Your device will become out of memory!
Open settings
-
+ Old Android version
+ You are using an old Android version that will no longer be supported in future updates. From blabber.im version 3.1.0 only devices with Android 5 or higher are supported. Please update your device firmware.
+