diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index fafd5ea2974..6d3e9066b79 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -39,6 +39,7 @@ import net.osmand.plus.helpers.*; import net.osmand.plus.importfiles.ImportHelper; import net.osmand.plus.inapp.InAppPurchaseHelperImpl; +import net.osmand.plus.inapp.InAppPurchaseUtils; import net.osmand.plus.keyevent.InputDevicesHelper; import net.osmand.plus.keyevent.KeyEventHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper; @@ -535,10 +536,9 @@ private void startApplicationBackground() { } } } - private void checkLiveUpdatesAlerts() { OsmandSettings settings = app.getSettings(); - if (settings.IS_LIVE_UPDATES_ON.get()) { + if (InAppPurchaseUtils.isLiveUpdatesAvailable(app) && settings.IS_LIVE_UPDATES_ON.get()) { LocalIndexHelper helper = new LocalIndexHelper(app); AlarmManager manager = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 219be9a03f9..d752b80ddd3 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -263,7 +263,7 @@ protected void createToolbar(@NonNull ViewGroup appBar) { container.addView(button); toolbarSwitchContainer = appBarLayout.findViewById(R.id.toolbar_switch_container); - updateToolbarSwitch(settings.IS_LIVE_UPDATES_ON.get()); + updateToolbarSwitch(InAppPurchaseUtils.isLiveUpdatesAvailable(app) && settings.IS_LIVE_UPDATES_ON.get()); } private void updateToolbarSwitch(boolean isChecked) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java index afec82f2db5..38298ae522b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java @@ -25,10 +25,10 @@ import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.IndexItem; +import net.osmand.plus.download.SrtmDownloadItem; import net.osmand.plus.download.local.LocalIndexHelper; -import net.osmand.plus.download.local.LocalItemType; import net.osmand.plus.download.local.LocalItem; -import net.osmand.plus.download.SrtmDownloadItem; +import net.osmand.plus.download.local.LocalItemType; import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.inapp.InAppPurchaseUtils; import net.osmand.plus.liveupdates.LiveUpdatesHelper; @@ -201,12 +201,12 @@ public void buttonPressed() { } private boolean isLiveUpdatesOn() { - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { - return mapActivity.getMyApplication().getSettings().IS_LIVE_UPDATES_ON.get(); - } else { - return false; + MapActivity activity = getMapActivity(); + if (activity != null) { + OsmandApplication app = activity.getMyApplication(); + return InAppPurchaseUtils.isLiveUpdatesAvailable(app) && app.getSettings().IS_LIVE_UPDATES_ON.get(); } + return false; } @Override @@ -660,7 +660,7 @@ private File getFileToRestore(@NonNull LocalItem item) { } else if (item.getType() == LocalItemType.ROAD_DATA) { parent = app.getAppPath(IndexConstants.ROADS_INDEX_DIR); } else if (item.getType() == LocalItemType.TILES_DATA) { - if (fileName.endsWith(IndexConstants.TIF_EXT)) { + if (fileName.endsWith(IndexConstants.TIF_EXT)) { parent = app.getAppPath(IndexConstants.GEOTIFF_DIR); } else { parent = app.getAppPath(IndexConstants.TILES_INDEX_DIR);