Reducing service reloads by package installations.
This might help with instabilities reported in #20
This commit is contained in:
parent
c9700b7389
commit
8a2c05cf4a
|
@ -17,8 +17,8 @@
|
|||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.microg.nlp"
|
||||
android:versionName="1.2.2"
|
||||
android:versionCode="1202">
|
||||
android:versionName="1.2.3"
|
||||
android:versionCode="1203">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="9"
|
||||
|
@ -106,7 +106,6 @@
|
|||
|
||||
<receiver android:name="org.microg.nlp.PackageReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_CHANGED" />
|
||||
<action android:name="android.intent.action.PACKAGE_UPGRADED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import org.microg.nlp.geocode.AbstractGeocodeService;
|
||||
import org.microg.nlp.location.AbstractLocationService;
|
||||
|
||||
|
@ -29,9 +30,15 @@ public class PackageReceiver extends BroadcastReceiver {
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d(TAG, "Intent received: " + intent);
|
||||
Log.d(TAG, "Reloading location service...");
|
||||
AbstractLocationService.reloadLocationService(context);
|
||||
Log.d(TAG, "Reloading geocoding service...");
|
||||
AbstractGeocodeService.reloadLocationService(context);
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
Preferences preferences = new Preferences(context);
|
||||
if (preferences.getLocationBackends().contains(packageName)) {
|
||||
Log.d(TAG, "Reloading location service for " + packageName);
|
||||
AbstractLocationService.reloadLocationService(context);
|
||||
}
|
||||
if (preferences.getGeocoderBackends().contains(packageName)) {
|
||||
Log.d(TAG, "Reloading geocoding service for " + packageName);
|
||||
AbstractGeocodeService.reloadLocationService(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue