arcao / Geocaching4Locus

A Locus simple add-on allows you to download and import caches directly from Geocaching.com si­te.
http://geocaching4locus.eu/
GNU General Public License v3.0
20 stars 8 forks source link

Incorrect check for "Is periodic updates enabled" state #48

Closed menion closed 10 years ago

menion commented 10 years ago

In one of latest changes in Locus API was introduced new system for handling requests to Locus - this was done, to prevent requesting information from incorrect Locus version.

Enable Live map in main menu

Check is done in LiveMapNotificationManager - line 191.

Seems that result is based on previously set parameter by this method

ActionTools.isPeriodicUpdatesEnabled(mContext);

Unfortunately this method is deprecated. It use unknown Locus version and because of it, it search for first available and get parameters from it. In case, user has Locus Free and Locus Pro at once, you cannot be sure, which version returns.

Recommended way is to get valid LocusInfo object by this method in same class

public static LocusInfo getLocusInfo(Context ctx,
                                     LocusUtils.LocusVersion lv)
                             throws RequiredVersionMissingException

Required version may be created

from existing request from Locus by

public static LocusUtils.LocusVersion createLocusVersion(Context ctx,
                                                         Intent intent)

or by simple

public static LocusUtils.LocusVersion getActiveVersion(Context ctx)

Which return currently running Locus (true in most cases)

arcao commented 10 years ago

Fixed.