mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
Merge remote branch 'origin/android_branch' into android_branch
This commit is contained in:
commit
c6ce5da5a5
3 changed files with 22 additions and 1 deletions
|
@ -66,6 +66,7 @@
|
|||
<string name="key_bt_addrs">key_bt_addrs</string>
|
||||
<string name="key_sms_phones">key_sms_phones</string>
|
||||
<string name="key_connstat_data">key_connstat_data</string>
|
||||
<string name="key_dev_id">key_dev_id</string>
|
||||
|
||||
<string name="key_notagain_sync">key_notagain_sync</string>
|
||||
<string name="key_notagain_chat">key_notagain_chat</string>
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue