diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index ad04f5f48..760943121 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -1,4 +1,4 @@ -/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ +/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh -j3"; -*- */ /* * Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights * reserved. @@ -270,6 +270,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getInitialAddr setJAddrRec( env, jaddr, &addr ); } +JNIEXPORT jstring JNICALL +Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getUUID +( JNIEnv* env, jclass C ) +{ + const char* uuid = XW_BT_UUID; + XP_LOGF( "uuid: %s", uuid ); + jstring jstr = (*env)->NewStringUTF( env, uuid ); + (*env)->DeleteLocalRef( env, jstr ); + return jstr; +} + JNIEXPORT jboolean JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_dict_1getInfo ( JNIEnv* env, jclass C, jbyteArray jDictBytes, jstring jpath, diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java index 940a10576..f2d564515 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java @@ -23,8 +23,12 @@ package org.eehouse.android.xw4; import android.app.Application; import java.util.UUID; +import org.eehouse.android.xw4.jni.XwJNI; + public class XWApp extends Application { + private static UUID s_UUID = null; + @Override public void onCreate() { @@ -41,7 +45,10 @@ public class XWApp extends Application { } public static UUID getAppUUID() { - return UUID.fromString( "d0837107-421f-11e1-b86c-0800200c9a66" ); + if ( null == s_UUID ) { + s_UUID = UUID.fromString( XwJNI.comms_getUUID() ); + } + return s_UUID; } public static String getAppName() { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java index 1ec41769a..dad4e5470 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java @@ -50,6 +50,7 @@ public class XwJNI { public static native void comms_getInitialAddr( CommsAddrRec addr, String relayHost, int relayPort ); + public static native String comms_getUUID(); // Game methods public static native int initJNI(); diff --git a/xwords4/common/comms.h b/xwords4/common/comms.h index 2c07b4128..cafd174f2 100644 --- a/xwords4/common/comms.h +++ b/xwords4/common/comms.h @@ -55,11 +55,7 @@ typedef enum { , COMMS_RELAYSTATE_ALLCONNECTED } CommsRelayState; - -/* WHAT SHOULD THIS BE? Copied from Whiteboard.... PENDING */ -#define XW_BT_UUID \ - { 0x83, 0xe0, 0x87, 0xae, 0x4e, 0x18, 0x46, 0xbe, \ - 0x83, 0xe0, 0x7b, 0x3d, 0xe6, 0xa1, 0xc3, 0x3b } +#define XW_BT_UUID "7be0d084-ff89-4d6d-9c78-594773a6f963" #define XW_BT_NAME "Crosswords"