Fix type cast error in location util

This commit is contained in:
estevez-dev 2020-07-08 10:54:41 +03:00
parent 819dfc725d
commit e5fe853f0b
3 changed files with 7 additions and 4 deletions

View File

@ -38,7 +38,7 @@ class LocationUtils {
static final long MIN_WORKER_LOCATION_UPDATE_INTERVAL_MS = 900000; //15 minutes
static int getLocationUpdatesState(Context context) {
return context.getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE).getInt(KEY_REQUESTING_LOCATION_UPDATES, LOCATION_UPDATES_DISABLED);
return (int) context.getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE).getInt(KEY_REQUESTING_LOCATION_UPDATES, LOCATION_UPDATES_DISABLED);
}
static long getLocationUpdateIntervals(Context context) {

View File

@ -97,10 +97,13 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
}
_switchLocationTrackingState(bool state) async {
await AppSettings().save({'location-updates-interval': _locationInterval.inSeconds, 'location-updates-priority': _accuracy, 'location-updates-show-notification': _showNotification});
if (state) {
try {
await platform.invokeMethod('startLocationService');
await platform.invokeMethod('startLocationService', <String, dynamic>{
'location-updates-interval': _locationInterval.inSeconds,
'location-updates-priority': _accuracy,
'location-updates-show-notification': _showNotification
});
} catch (e) {
_locationTrackingEnabled = false;
}

View File

@ -1,7 +1,7 @@
name: hass_client
description: Home Assistant Android Client
version: 1.3.0+1302
version: 1.3.0+1303
environment: