don't check for updates on DEBUG builds as the server doesn't handle

that case (yet)
This commit is contained in:
Eric House 2015-02-17 06:59:40 -08:00
parent 749b9a5c19
commit 1a87812f2b
2 changed files with 21 additions and 14 deletions

View file

@ -1252,7 +1252,9 @@ public class GamesListDelegate extends ListDelegateBase
showItemsIf( ONEGAME_ITEMS, menu, 1 == nGamesSelected );
showItemsIf( ONEGROUP_ITEMS, menu, 1 == nGroupsSelected );
boolean enable = showDbg && nothingSelected
// check for updates only serves release builds, so don't offer in
// DEBUG case
boolean enable = showDbg && !BuildConfig.DEBUG && nothingSelected
&& UpdateCheckReceiver.haveToCheck( m_activity );
Utils.setItemVisible( menu, R.id.games_menu_checkupdates, enable );

View file

@ -92,22 +92,27 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
public static void restartTimer( Context context )
{
AlarmManager am =
(AlarmManager)context.getSystemService( Context.ALARM_SERVICE );
if ( BuildConfig.DEBUG ) {
DbgUtils.logf( "UpdateCheckReceiver.restartTimer(): dropping because"
+ " debug builds can't be updated" );
} else {
AlarmManager am =
(AlarmManager)context.getSystemService( Context.ALARM_SERVICE );
Intent intent = new Intent( context, UpdateCheckReceiver.class );
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
am.cancel( pi );
Intent intent = new Intent( context, UpdateCheckReceiver.class );
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
am.cancel( pi );
long interval_millis = INTERVAL_ONEDAY;
if ( !devOK( context ) ) {
interval_millis *= INTERVAL_NDAYS;
long interval_millis = INTERVAL_ONEDAY;
if ( !devOK( context ) ) {
interval_millis *= INTERVAL_NDAYS;
}
interval_millis = (interval_millis / 2)
+ Math.abs(Utils.nextRandomInt() % interval_millis);
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + interval_millis,
interval_millis, pi );
}
interval_millis = (interval_millis / 2)
+ Math.abs(Utils.nextRandomInt() % interval_millis);
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + interval_millis,
interval_millis, pi );
}
// Is app upgradeable OR have we installed any dicts?