Skip to content

Commit

Permalink
Fixed not working auto-hide for Live Map notification when Live Map h…
Browse files Browse the repository at this point in the history
…as been disabled before Locus Map exit
  • Loading branch information
arcao committed Aug 5, 2017
1 parent 5a6c8f9 commit 2be6341
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 65 deletions.
4 changes: 2 additions & 2 deletions src/main/AndroidManifest.xml
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.arcao.geocaching4locus"
android:versionName="2.1.5.3"
android:versionName="2.1.5.4"
android:installLocation="auto">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Expand Down Expand Up @@ -41,7 +41,7 @@

<receiver
android:name=".receiver.LiveMapBroadcastReceiver"
android:enabled="false"
android:exported="true"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="locus.api.android.ACTION_PERIODIC_UPDATE" />
Expand Down
Expand Up @@ -234,19 +234,17 @@ public void setLiveMapEnabled(boolean enabled) {
}

try {
if (enabled) {
ActionTools.enablePeriodicUpdatesReceiver(mContext, locusVersion, LiveMapBroadcastReceiver.class);
} else {
ActionTools.disablePeriodicUpdatesReceiver(mContext, locusVersion, LiveMapBroadcastReceiver.class);
}
mSharedPrefs.edit().putBoolean(PrefConstants.LIVE_MAP, enabled).apply();
// make sure Live Map broadcast receiver is always enabled
ActionTools.enablePeriodicUpdatesReceiver(mContext, locusVersion, LiveMapBroadcastReceiver.class);
} catch (Throwable e) {
Timber.e(e, "Unable to enable or disable LiveMapBroadcastReceiver.");
Timber.e(e, "Unable to enable LiveMapBroadcastReceiver.");
}

mSharedPrefs.edit().putBoolean(PrefConstants.LIVE_MAP, enabled).apply();
}

public boolean isLiveMapEnabled() {
return PackageManagerUtil.isComponentEnabled(mContext, LiveMapBroadcastReceiver.class);
return mSharedPrefs.getBoolean(PrefConstants.LIVE_MAP, false);
}

public void addLiveMapStateChangeListener(LiveMapStateChangeListener liveMapStateChangeListener) {
Expand Down

This file was deleted.

0 comments on commit 2be6341

Please sign in to comment.