diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 572895e40..9069f7d03 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -940,9 +940,11 @@ public class BoardActivity extends XWActivity && !NFCUtils.nfcAvail( this )[1] ) { showDialog( ENABLE_NFC ); } else { - GameUtils.launchInviteActivity( this, which, - m_room, null, m_gi.dictLang, - m_gi.dictName, m_gi.nPlayers ); + String inviteID = GameUtils.formatGameID( m_gi.gameID ); + GameUtils.launchInviteActivity( this, which, m_room, + inviteID, m_gi.dictLang, + m_gi.dictName, + m_gi.nPlayers ); } } } else if ( AlertDialog.BUTTON_POSITIVE == which ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index ea157dfd6..b542ca4b9 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -522,9 +522,8 @@ public class GameUtils { int lang, String dict, int nPlayers ) { - if ( null == inviteID ) { - inviteID = makeRandomID(); - } + Assert.assertNotNull( inviteID ); + String msgString; if ( DlgDelegate.NFC_BTN == chosen ) { msgString = NetLaunchInfo.makeLaunchJSON( activity, room, inviteID, @@ -870,10 +869,17 @@ public class GameUtils { activity.startActivity( intent ); } + public static String formatGameID( int gameID ) + { + Assert.assertTrue( 0 != gameID ); + // substring: Keep it short so fits in SMS better + return String.format( "%X", gameID ).substring( 0, 4 ); + } + public static String makeRandomID() { int rint = newGameID(); - return String.format( "%X", rint ).substring( 0, 4 ); + return formatGameID( rint ); } public static int newGameID()