Restart location service after app update

This commit is contained in:
estevez-dev 2020-07-07 23:42:21 +03:00
parent ccbc2eec47
commit 819dfc725d
3 changed files with 6 additions and 4 deletions

View File

@ -72,9 +72,10 @@
<action android:name="android.app.action.NEXT_ALARM_CLOCK_CHANGED" />
</intent-filter>
</receiver>
<receiver android:name=".LocationUpdatesAfterReboot">
<receiver android:name=".RestartLocationUpdate">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service

View File

@ -4,10 +4,11 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class LocationUpdatesAfterReboot extends BroadcastReceiver {
public class RestartLocationUpdate extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
if (LocationUtils.getLocationUpdatesState(context) == LocationUtils.LOCATION_UPDATES_SERVICE && Intent.ACTION_BOOT_COMPLETED.equalsIgnoreCase(intent.getAction())) {
if (LocationUtils.getLocationUpdatesState(context) == LocationUtils.LOCATION_UPDATES_SERVICE &&
(Intent.ACTION_BOOT_COMPLETED.equalsIgnoreCase(intent.getAction()) || Intent.ACTION_MY_PACKAGE_REPLACED.equalsIgnoreCase(intent.getAction()))) {
LocationUtils.startServiceFromBroadcast(context);
}
}

View File

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