diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index eee08d6..7a1d88a 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -14,6 +14,7 @@
+
diff --git a/README b/README
index 0100d6d..b269d76 100755
--- a/README
+++ b/README
@@ -1,24 +1,6 @@
KalSMS is an Android app that acts as a SMS and MMS gateway.
-For more information, see http://youngj.github.com/KalSMS/
-Features
---------
-* Can be deployed almost anywhere in the world
-* Designed to allow non-technical users to do all setup/maintenance
- of deployed phones
-* Can send outgoing SMS in excess of Android's limit of 100 messages
- per app per hour by installing expansion packs
-* Many different phones running KalSMS can be connected to a single server
- (each phone could forward messages for a different mobile network)
-* Authenticates with password shared between phone and server
-* Retries forwarding messages after a delay if there is an error
- (e.g. due to temporarily broken internet or GSM connection)
-* Notifies the server of the status of outgoing messages
-* Forwards incoming MMS messages (pictures/video/audio)
-* Shows log messages to user to facilitate troubleshooting
-* Can prevent incoming messages from being stored in Messaging inbox
-* Can forward messages already received in Messaging inbox
-
-License
--------
+For more information and installation instructions,
+see http://youngj.github.com/KalSMS/
+
The code is released under the MIT license; see LICENSE
\ No newline at end of file
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 49f28f1..70398b5 100755
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -24,4 +24,16 @@
- 3600
- 0
+
+
+ - disconnect when screen turns off
+ - stay connected when plugged in
+ - always stay connected
+
+
+
+ - screen
+ - plugged
+ - never
+
\ No newline at end of file
diff --git a/res/xml/prefs.xml b/res/xml/prefs.xml
index 5539904..dfa1ce6 100755
--- a/res/xml/prefs.xml
+++ b/res/xml/prefs.xml
@@ -18,7 +18,7 @@
@@ -43,4 +43,13 @@
android:summaryOn="Incoming SMS will be stored in Messaging inbox"
>
+
+
+
\ No newline at end of file
diff --git a/src/org/envaya/kalsms/ui/Prefs.java b/src/org/envaya/kalsms/ui/Prefs.java
index cd88366..29c13dc 100755
--- a/src/org/envaya/kalsms/ui/Prefs.java
+++ b/src/org/envaya/kalsms/ui/Prefs.java
@@ -8,6 +8,8 @@ import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.view.Menu;
import org.envaya.kalsms.App;
import org.envaya.kalsms.R;
@@ -50,6 +52,26 @@ public class Prefs extends PreferenceActivity implements OnSharedPreferenceChang
{
app.setOutgoingMessageAlarm();
}
+ else if (key.equals("wifi_sleep_policy"))
+ {
+ int value;
+ String valueStr = sharedPreferences.getString("wifi_sleep_policy", "screen");
+ if ("screen".equals(valueStr))
+ {
+ value = Settings.System.WIFI_SLEEP_POLICY_DEFAULT;
+ }
+ else if ("plugged".equals(valueStr))
+ {
+ value = Settings.System.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
+ }
+ else
+ {
+ value = Settings.System.WIFI_SLEEP_POLICY_NEVER;
+ }
+
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.WIFI_SLEEP_POLICY, value);
+ }
else if (key.equals("server_url"))
{
app.log("Server URL changed to: " + app.getDisplayString(app.getServerUrl()));
@@ -73,7 +95,34 @@ public class Prefs extends PreferenceActivity implements OnSharedPreferenceChang
private void updatePrefSummary(Preference p)
{
- if (p instanceof ListPreference) {
+ if ("wifi_sleep_policy".equals(p.getKey()))
+ {
+ int sleepPolicy;
+
+ try
+ {
+ sleepPolicy = Settings.System.getInt(this.getContentResolver(),
+ Settings.System.WIFI_SLEEP_POLICY);
+ }
+ catch (SettingNotFoundException ex)
+ {
+ sleepPolicy = Settings.System.WIFI_SLEEP_POLICY_DEFAULT;
+ }
+
+ switch (sleepPolicy)
+ {
+ case Settings.System.WIFI_SLEEP_POLICY_DEFAULT:
+ p.setSummary("Wi-Fi will disconnect when the phone sleeps");
+ break;
+ case Settings.System.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED:
+ p.setSummary("Wi-Fi will disconnect when the phone sleeps unless it is plugged in");
+ break;
+ case Settings.System.WIFI_SLEEP_POLICY_NEVER:
+ p.setSummary("Wi-Fi will stay connected when the phone sleeps");
+ break;
+ }
+ }
+ else if (p instanceof ListPreference) {
p.setSummary(((ListPreference)p).getEntry());
}
else if (p instanceof EditTextPreference) {