mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 17:45:50 +01:00
fix cm/lineage weather not updating after changing location
This commit is contained in:
parent
fccd2ebb77
commit
1752b1b51e
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user