1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05:49 +01:00

fix cm/lineage weather not updating after changing location

This commit is contained in:
Andreas Shimokawa 2017-12-12 22:36:15 +01:00
parent fccd2ebb77
commit 1752b1b51e
3 changed files with 7 additions and 4 deletions

View File

@ -43,11 +43,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandPreferencesActivity;
import nodomain.freeyourgadget.gadgetbridge.externalevents.CMWeatherReceiver;
import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
@ -268,7 +268,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
GBApplication.getPrefs().getPreferences().edit().putString("weather_cityid",null).apply();
preference.setSummary(newVal.toString());
Intent intent = new Intent("GB_UPDATE_WEATHER");
intent.setPackage(CMWeatherReceiver.class.getCanonicalName());
intent.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intent);
return true;
}

View File

@ -51,7 +51,7 @@ public class AlarmReceiver extends BroadcastReceiver {
Context context = GBApplication.getContext();
Intent intent = new Intent("DAILY_ALARM");
intent.setPackage(BuildConfig.APPLICATION_ID);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, new Intent("DAILY_ALARM"), 0);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
AlarmManager am = (AlarmManager) (context.getSystemService(Context.ALARM_SERVICE));
if (am != null) {

View File

@ -18,6 +18,7 @@ import cyanogenmod.weather.CMWeatherManager;
import cyanogenmod.weather.WeatherInfo;
import cyanogenmod.weather.WeatherLocation;
import cyanogenmod.weather.util.WeatherUtils;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.model.Weather;
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
@ -83,7 +84,9 @@ public class CMWeatherReceiver extends BroadcastReceiver implements CMWeatherMan
}
if (enable) {
mPendingIntent = PendingIntent.getBroadcast(mContext, 0, new Intent("GB_UPDATE_WEATHER"), 0);
Intent intent = new Intent("GB_UPDATE_WEATHER");
intent.setPackage(BuildConfig.APPLICATION_ID);
mPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
am.setInexactRepeating(AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis() + 10000, AlarmManager.INTERVAL_HOUR, mPendingIntent);
} else {
am.cancel(mPendingIntent);