diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index a5d14eda1..872784eb0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -1124,7 +1124,8 @@ public class BTService extends XWService { if ( null == rowids || 0 == rowids.length ) { CommsAddrRec addr = nli.makeAddrRec( BTService.this ); long rowid = GameUtils.makeNewMultiGame( BTService.this, nli, - m_btMsgSink, null ); + m_btMsgSink, + getUtilCtxt() ); if ( DBUtils.ROWID_NOTFOUND == rowid ) { result = BTCmd.INVITE_FAILED; } else { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java index 07cb39fba..359fa1fd1 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -53,8 +53,6 @@ import org.eehouse.android.xw4.jni.CommsAddrRec; import org.eehouse.android.xw4.jni.GameSummary; import org.eehouse.android.xw4.jni.LastMoveInfo; import org.eehouse.android.xw4.jni.UtilCtxt.DevIDType; -import org.eehouse.android.xw4.jni.UtilCtxt; -import org.eehouse.android.xw4.jni.UtilCtxtImpl; import org.eehouse.android.xw4.jni.XwJNI; import org.eehouse.android.xw4.loc.LocUtils; @@ -256,8 +254,8 @@ public class RelayService extends XWService // make the initial connection -- needs access to util. That // should be fixable -- eventually. RelayMsgSink sink = new RelayMsgSink(); - UtilCtxt util = new UtilCtxtImpl( this ); - long rowid = GameUtils.makeNewMultiGame( this, nli, sink, util ); + long rowid = GameUtils.makeNewMultiGame( this, nli, sink, + getUtilCtxt() ); if ( DBUtils.ROWID_NOTFOUND != rowid ) { if ( null != nli.gameName && 0 < nli.gameName.length() ) { DBUtils.setName( this, rowid, nli.gameName ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java index c17ccee2a..c13e02c70 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java @@ -637,24 +637,13 @@ public class SMSService extends XWService { private void makeForInvite( String phone, NetLaunchInfo nli ) { - SMSMsgSink sink = new SMSMsgSink( this ); - long rowid = GameUtils.makeNewMultiGame( this, nli, sink, null ); + long rowid = GameUtils.makeNewMultiGame( this, nli, + new SMSMsgSink( this ), + getUtilCtxt() ); postNotification( phone, nli.gameID(), rowid ); ackInvite( phone, nli.gameID() ); } - private void makeForInvite( String phone, int gameID, String gameName, - int lang, String dict, int nPlayersT, - int nPlayersH, int forceChannel ) - { - long rowid = - GameUtils.makeNewGame( this, gameID, new CommsAddrRec( phone ), - lang, dict, nPlayersT, nPlayersH, - forceChannel, gameName ); - postNotification( phone, gameID, rowid ); - ackInvite( phone, gameID ); - } - private PendingIntent makeStatusIntent( String msg ) { Intent intent = new Intent( msg ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java index eb1be40ac..7a131cdb3 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java @@ -28,13 +28,16 @@ import java.util.HashSet; import java.util.Set; import org.eehouse.android.xw4.MultiService.MultiEvent; - +import org.eehouse.android.xw4.jni.UtilCtxt; +import org.eehouse.android.xw4.jni.UtilCtxtImpl; public class XWService extends Service { protected static MultiService s_srcMgr = null; private static Set s_seen = new HashSet(); + private UtilCtxt m_utilCtxt; + @Override public IBinder onBind( Intent intent ) { @@ -74,4 +77,12 @@ public class XWService extends Service { DbgUtils.logf( "XWService.checkNotDupe(%s) => %b", inviteID, !isDupe ); return !isDupe; } + + protected UtilCtxt getUtilCtxt() + { + if ( null == m_utilCtxt ) { + m_utilCtxt = new UtilCtxtImpl( this ); + } + return m_utilCtxt; + } }