Fix low battery mode

This commit is contained in:
Mieszko Wrzeszczyński 2019-01-13 14:10:50 +01:00
parent d88525a764
commit e1c266263a
3 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ android {
applicationId "com.uam.wmi.findmytutor"
minSdkVersion 22
targetSdkVersion 27
versionCode 63
versionCode 64
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

View File

@ -427,7 +427,7 @@ public abstract class BaseActivity
sharingFragment = SharingFragment.newInstance();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.activity_content, sharingFragment);
ft.addToBackStack(null);
//ft.addToBackStack(null);
ft.commit();
}
@ -437,7 +437,7 @@ public abstract class BaseActivity
userListFragment = UsersListFragment.newInstance();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.activity_content, userListFragment);
ft.addToBackStack(null);
//ft.addToBackStack(null);
ft.commit();
}

View File

@ -124,6 +124,12 @@ public class BackgroundLocalizationService extends Service {
mCurrentLocation = locationResult.getLastLocation();
sendCoordinateToBackend(mCurrentLocation);
changeBackgroundMode();
//Restart service when a user started using presence in GPS mode and wmi is currently available
if (WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())
&& PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())) {
restartService();
}
}
}
};
@ -220,12 +226,6 @@ public class BackgroundLocalizationService extends Service {
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
mFusedLocationClient.requestLocationUpdates(mLocationRequest,
mLocationCallback, Looper.getMainLooper());
//Restart service when a user started using presence in GPS mode and wmi is currently available
if (WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())
&& PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())) {
restartService();
}
}
}