Add usage of wifi in presence mode #162

Merged
s416204 merged 1 commits from presence-wifi-approach into develop 2019-01-13 14:11:38 +01:00
3 changed files with 9 additions and 9 deletions

View File

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

View File

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

View File

@ -124,6 +124,12 @@ public class BackgroundLocalizationService extends Service {
mCurrentLocation = locationResult.getLastLocation(); mCurrentLocation = locationResult.getLastLocation();
sendCoordinateToBackend(mCurrentLocation); sendCoordinateToBackend(mCurrentLocation);
changeBackgroundMode(); 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 = LocationServices.getFusedLocationProviderClient(this);
mFusedLocationClient.requestLocationUpdates(mLocationRequest, mFusedLocationClient.requestLocationUpdates(mLocationRequest,
mLocationCallback, Looper.getMainLooper()); 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();
}
} }
} }