Attempt to fix loading on boot
parent
d93ca60284
commit
1b4c9dfc33
|
@ -147,10 +147,16 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
Log.d(TAG, "onStop called");
|
Log.d(TAG, "onStop called");
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
// Get updated preferences
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
|
// Save updated preferences
|
||||||
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
|
// editor.putBoolean("pref_start_boot", );
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
// Restart service so settings can take effect
|
// Restart service so settings can take effect
|
||||||
stopService(new Intent(this, LocationService.class));
|
stopService(new Intent(this, LocationService.class));
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
if (sharedPref.getBoolean("gps_switch", false)) {
|
if (sharedPref.getBoolean("gps_switch", false)) {
|
||||||
|
|
||||||
// Ask for location permissions (can't be done in service, only activity)
|
// Ask for location permissions (can't be done in service, only activity)
|
||||||
|
@ -219,8 +225,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
protected boolean isValidFragment(String fragmentName) {
|
protected boolean isValidFragment(String fragmentName) {
|
||||||
return PreferenceFragment.class.getName().equals(fragmentName)
|
return PreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|| GeneralPreferenceFragment.class.getName().equals(fragmentName);
|
|| GeneralPreferenceFragment.class.getName().equals(fragmentName);
|
||||||
// || MapPreferenceFragment.class.getName().equals(fragmentName)
|
|
||||||
// || NotificationPreferenceFragment.class.getName().equals(fragmentName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -242,7 +246,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
// Bind the summary of preferences to their value
|
// Bind the summary of preferences to their value
|
||||||
bindPreferenceSummaryToValue(findPreference("broadcast_frequency"));
|
bindPreferenceSummaryToValue(findPreference("broadcast_frequency"));
|
||||||
bindPreferenceSummaryToValue(findPreference("broadcast_priority"));
|
bindPreferenceSummaryToValue(findPreference("broadcast_priority"));
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
classpath 'com.google.gms:google-services:3.0.0'
|
classpath 'com.google.gms:google-services:3.0.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
Loading…
Reference in New Issue