diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 1f8e6bf26..d617d1a7c 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -66,6 +66,7 @@ key_bt_addrs key_sms_phones key_connstat_data + key_dev_id key_notagain_sync key_notagain_chat diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java index 0c730348e..1cc391527 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java @@ -67,6 +67,9 @@ public class UpdateCheckReceiver extends BroadcastReceiver { private static final String k_INDEX = "index"; private static final String k_URL = "url"; private static final String k_PARAMS = "params"; + private static final String k_DEVID = "did"; + + private static boolean s_loggedInstaller = false; // remove after one release @Override public void onReceive( Context context, Intent intent ) @@ -108,7 +111,11 @@ public class UpdateCheckReceiver extends BroadcastReceiver { String installer = pm.getInstallerPackageName( packageName ); if ( "com.google.android.feedback".equals( installer ) || "com.android.vending".equals( installer ) ) { - DbgUtils.logf( "checkVersion; skipping market app" ); + if ( !s_loggedInstaller ) { + DbgUtils.logf( "checkVersion; skipping market app; installer=%s", + installer ); + s_loggedInstaller = true; + } } else { try { int versionCode = pm.getPackageInfo( packageName, 0 ).versionCode; @@ -123,6 +130,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { appParams.put( k_DEVOK, true ); } params.put( k_APP, appParams ); + params.put( k_DEVID, XWPrefs.getDevID( context ) ); } catch ( PackageManager.NameNotFoundException nnfe ) { DbgUtils.loge( nnfe ); } catch ( org.json.JSONException jse ) { @@ -143,6 +151,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { if ( 0 < dictParams.length() ) { try { params.put( k_DICTS, dictParams ); + params.put( k_DEVID, XWPrefs.getDevID( context ) ); } catch ( org.json.JSONException jse ) { DbgUtils.loge( jse ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java index 8434f1f98..7fafc5c33 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java @@ -173,6 +173,17 @@ public class XWPrefs { return getPrefsStringArray( context, R.string.key_bt_addrs ); } + public static String getDevID( Context context ) + { + String id = getPrefsString( context, R.string.key_dev_id ); + if ( null == id || 0 == id.length() ) { + id = String.format( "%08X-%08X", Utils.nextRandomInt(), + Utils.nextRandomInt() ); + setPrefsString( context, R.string.key_dev_id, id ); + } + return id; + } + protected static String getPrefsString( Context context, int keyID ) { String key = context.getString( keyID );