diff options
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | res/values/strings.xml | 5 | ||||
-rw-r--r-- | res/xml/preferences.xml | 7 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalManager.java | 7 | ||||
-rw-r--r-- | src/org/connectbot/util/PreferenceConstants.java | 2 |
5 files changed, 22 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 96c4556..6a2b063 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.connectbot" android:versionName="1.6-dev" - android:versionCode="198"> + android:versionCode="199"> <application android:icon="@drawable/icon" diff --git a/res/values/strings.xml b/res/values/strings.xml index a3e210f..ef88fdf 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -148,6 +148,11 @@ <!-- Summary for the update check preference --> <string name="pref_update_summary">Set the maximum frequency to check for ConnectBot updates</string> + <!-- Name for the preference that forces the service to stay running in the background.--> + <string name="pref_conn_persist_title">Persist connections</string> + <!-- Summary for the preference that forces the service to stay running in the background. --> + <string name="pref_conn_persist_summary">Force connections to stay connected while in background</string> + <!-- Name for the keyboard shortcuts preference --> <string name="pref_keymode_title">Directory shortcuts</string> <!-- Summary for the keyboard shortcuts preference --> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index ec75d48..fb722f7 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -34,6 +34,13 @@ android:defaultValue="Daily" /> + <CheckBoxPreference + android:key="connPersist" + android:title="@string/pref_conn_persist_title" + android:summary="@string/pref_conn_persist_summary" + android:defaultValue="true" + /> + <PreferenceCategory android:title="@string/pref_emulation_category"> diff --git a/src/org/connectbot/service/TerminalManager.java b/src/org/connectbot/service/TerminalManager.java index 2faac98..1e057af 100644 --- a/src/org/connectbot/service/TerminalManager.java +++ b/src/org/connectbot/service/TerminalManager.java @@ -160,6 +160,13 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen enableMediaPlayer(); notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + /* If user wants the connections to stay alive at all costs, + * set the service to be "foreground." + */ + if (prefs.getBoolean(PreferenceConstants.CONNECTION_PERSIST, true)) { + setForeground(true); + } } @Override diff --git a/src/org/connectbot/util/PreferenceConstants.java b/src/org/connectbot/util/PreferenceConstants.java index beec052..7231d8f 100644 --- a/src/org/connectbot/util/PreferenceConstants.java +++ b/src/org/connectbot/util/PreferenceConstants.java @@ -70,4 +70,6 @@ public class PreferenceConstants { public static final String BELL_VIBRATE = "bellVibrate"; public static final String BELL_NOTIFICATION = "bellNotification"; public static final float DEFAULT_BELL_VOLUME = 0.25f; + + public static final String CONNECTION_PERSIST = "connPersist"; } |