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 98f3cf5c1..6011a22b7 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 @@ -71,6 +71,11 @@ public class XWPrefs { return getPrefsBoolean( context, R.string.key_ignore_fcm, false ); } + public static boolean getToastFCM( Context context ) + { + return getPrefsBoolean( context, R.string.key_show_fcm, false ); + } + public static boolean getSMSToSelfEnabled( Context context ) { return getPrefsBoolean( context, R.string.key_enable_sms_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 0f609e3d2..4041cee78 100644 --- a/xwords4/android/app/src/main/res/values/common_rsrc.xml +++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml @@ -127,6 +127,7 @@ key_enable_sms_toself key_enable_smsproto key_ignore_fcm + key_show_fcm 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 7a2747aeb..9aaaff64b 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2644,6 +2644,7 @@ Mimic life without a google account Show SMS sends, receives + Show FCM receives diff --git a/xwords4/android/app/src/main/res/xml/xwprefs.xml b/xwords4/android/app/src/main/res/xml/xwprefs.xml index 61b110a6d..9045fe6b5 100644 --- a/xwords4/android/app/src/main/res/xml/xwprefs.xml +++ b/xwords4/android/app/src/main/res/xml/xwprefs.xml @@ -398,6 +398,10 @@ android:summary="@string/ignore_fcm_summary" android:defaultValue="false" /> + data = message.getData(); Log.d( TAG, "onMessageReceived(data=%s)", data ); + boolean toastFCM = XWPrefs.getToastFCM( this ); String value = data.get( "msgs64" ); if ( null != value ) { @@ -71,6 +68,10 @@ public class FBMService extends FirebaseMessagingService { try { JSONArray msgs64 = new JSONArray( value ); String[] strs64 = new String[msgs64.length()]; + if ( toastFCM ) { + DbgUtils.showf( this, "%s.onMessageReceived(): got %d msgs", + TAG, strs64.length ); + } for ( int ii = 0; ii < strs64.length; ++ii ) { strs64[ii] = msgs64.optString(ii); @@ -94,6 +95,10 @@ public class FBMService extends FirebaseMessagingService { value = data.get( "getMoves" ); if ( null != value && Boolean.parseBoolean( value ) ) { RelayService.timerFired( this ); + if ( toastFCM ) { + DbgUtils.showf( this, "%s.onMessageReceived(): got 'getMoves'", + TAG ); + } } value = data.get( "msg" ); @@ -121,7 +126,6 @@ public class FBMService extends FirebaseMessagingService { if ( null == result ) { getTokenAsync( context ); } - return result; }