Bound and unbound from service in Fragment onResume and onPause so we don't have so many things bound to the service at once
This commit is contained in:
@@ -68,18 +68,18 @@ public class FragmentOsdBaseClass extends Fragment {
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
Log.i(TAG, "onStart()");
|
Log.i(TAG, "onStart()");
|
||||||
if (mUtil.isServerRunning()) {
|
|
||||||
Log.i(TAG, "onStart() - Binding to Server");
|
|
||||||
mUtil.bindToServer(mContext, mConnection);
|
|
||||||
} else {
|
|
||||||
Log.i(TAG, "onStart() - Server Not Running");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Log.i(TAG, "onResume()");
|
Log.i(TAG, "onResume()");
|
||||||
|
if (mUtil.isServerRunning()) {
|
||||||
|
Log.i(TAG, "onResume() - Binding to Server");
|
||||||
|
mUtil.bindToServer(mContext, mConnection);
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "onResume() - Server Not Running");
|
||||||
|
}
|
||||||
mUiTimer = new Timer();
|
mUiTimer = new Timer();
|
||||||
mUiTimer.schedule(new TimerTask() {
|
mUiTimer.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
@@ -94,13 +94,13 @@ public class FragmentOsdBaseClass extends Fragment {
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
Log.i(TAG, "onPause()");
|
Log.i(TAG, "onPause()");
|
||||||
mUiTimer.cancel();
|
mUiTimer.cancel();
|
||||||
|
mUtil.unbindFromServer(mContext, mConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
Log.i(TAG, "onStop()");
|
Log.i(TAG, "onStop()");
|
||||||
mUtil.unbindFromServer(mContext, mConnection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user