add debug preference to determine whether to use sendDataMessage()

This commit is contained in:
Eric House 2013-11-26 07:11:22 -08:00
parent f7a09551d5
commit eab12200af
3 changed files with 12 additions and 2 deletions

View file

@ -39,6 +39,7 @@
<string name="key_dict_host">key_dict_host3</string>
<string name="key_logging_on">key_logging_on</string>
<string name="key_show_sms">key_show_sms</string>
<string name="key_send_data_sms">key_send_data_sms</string>
<string name="key_init_hintsallowed">key_init_hintsallowed</string>
<string name="key_init_nethintsallowed">key_init_nethintsallowed</string>
<string name="key_init_autojuggle">key_init_autojuggle</string>
@ -137,6 +138,8 @@
<string name="debug_features">Enable debug features</string>
<string name="debug_features_summary">Menuitems etc. (release builds
only)</string>
<string name="title_send_data_sms">Send SMS as data</string>
<string name="summary_send_data_sms">(fails on CDMA phones)</string>
<string name="git_rev_title">Source version id</string>
<string name="relay_port">Relay game port</string>

View file

@ -328,6 +328,11 @@
android:title="Show SMS sends, receives"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_send_data_sms"
android:title="@string/title_send_data_sms"
android:summary="@string/summary_send_data_sms"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_relay_host"
android:title="@string/relay_host"

View file

@ -55,7 +55,7 @@ public class SMSService extends XWService {
private static final String INSTALL_URL = "http://eehouse.org/_/a.py/a ";
private static final int MAX_SMS_LEN = 140; // ??? differs by network
private static final boolean s_asData = true;
// private static final boolean s_asData = true;
private static final String MSG_SENT = "MSG_SENT";
private static final String MSG_DELIVERED = "MSG_DELIVERED";
@ -407,7 +407,9 @@ public class SMSService extends XWService {
byte[] data = bas.toByteArray();
boolean result;
if ( s_asData ) {
boolean asData =
XWPrefs.getPrefsBoolean( this, R.string.key_send_data_sms, false );
if ( asData ) {
byte[][] msgs = breakAndEncode( data );
result = sendBuffers( msgs, phone );
} else {