diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java index ca83a12e2..8f4a1870e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java @@ -801,11 +801,11 @@ public class RelayService extends XWService private void requestMessagesImpl( XWRelayReg reg ) { - ByteArrayOutputStream bas = new ByteArrayOutputStream(); try { DevIDType[] typp = new DevIDType[1]; String devid = getDevID( typp ); if ( null != devid ) { + ByteArrayOutputStream bas = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream( bas ); writeVLIString( out, devid ); // Log.d( TAG, "requestMessagesImpl(): devid: %s; type: " + typp[0], devid ); @@ -1606,7 +1606,8 @@ public class RelayService extends XWService private boolean shouldMaintainConnection() { boolean result = relayEnabled( this ) - && (XWApp.GCM_IGNORED || !s_gcmWorking); + && (!s_gcmWorking || XWPrefs.getIgnoreGCM( this )); + if ( result ) { long interval = Utils.getCurSeconds() - m_lastGamePacketReceived; result = interval < MAX_KEEPALIVE_SECS; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java index dbf740b99..b76ed4bfb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java @@ -39,7 +39,6 @@ public class XWApp extends Application { public static final boolean ATTACH_SUPPORTED = false; public static final boolean LOG_LIFECYLE = false; public static final boolean DEBUG_EXP_TIMERS = false; - public static final boolean GCM_IGNORED = false; public static final boolean UDP_ENABLED = true; public static final boolean SMS_INVITE_ENABLED = true; public static final boolean LOCUTILS_ENABLED = false; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java index 6747f05a2..ccf1779b7 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java @@ -67,6 +67,16 @@ public class XWPrefs { return getPrefsBoolean( context, R.string.key_enable_nfc_toself, false ); } + public static boolean getIgnoreGCM( Context context ) + { + return getPrefsBoolean( context, R.string.key_ignore_gcm, false ); + } + + public static boolean getToastGCM( Context context ) + { + return getPrefsBoolean( context, R.string.key_show_gcm, false ); + } + public static boolean getRelayInviteToSelfEnabled( Context context ) { return getPrefsBoolean( context, R.string.key_enable_relay_toself, false ); diff --git a/xwords4/android/app/src/main/res/values/common_rsrc.xml b/xwords4/android/app/src/main/res/values/common_rsrc.xml index 50ab6a10b..ba3ebce7d 100644 --- a/xwords4/android/app/src/main/res/values/common_rsrc.xml +++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml @@ -126,6 +126,8 @@ key_enable_nfc_toself key_enable_sms_toself key_enable_relay_toself + key_ignore_gcm + key_show_gcm key_nag_intervals key_download_path key_got_langdict diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index 57aa7015b..e7f43e917 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2601,6 +2601,12 @@ Enable relay invites to self (To aid testing and debugging) + Ignore incoming GCM messages + Mimic life without a google account + + Show SMS sends, receives + Show GCM receives + One move sent diff --git a/xwords4/android/app/src/main/res/xml/xwprefs.xml b/xwords4/android/app/src/main/res/xml/xwprefs.xml index 43dc96048..12fc30c9f 100644 --- a/xwords4/android/app/src/main/res/xml/xwprefs.xml +++ b/xwords4/android/app/src/main/res/xml/xwprefs.xml @@ -407,7 +407,7 @@ /> @@ -420,6 +420,15 @@ android:summary="@string/enable_relay_toself_summary" android:defaultValue="false" /> + +