public final class ChatServiceBinder
extends android.support.v4.app.Fragment
Activity.onStart()
and detach with Activity.onStop()
.
Orientation change will unbind a service from destroyed activity and then it will bind again to the recreated activity. Minimizing the chat will unbind the activity and it will be re-bound when resumed.
All chat communications should be done between Activity.onResume()
and Activity.onPause()
as
the service might not be connected outside of that state and the instance of chat won't be able to communicate.
Constructor and Description |
---|
ChatServiceBinder() |
Modifier and Type | Method and Description |
---|---|
void |
onCreate(android.os.Bundle savedInstanceState) |
void |
onStart()
Bind on start to assure that activity has service connection while visible
Chat service will bounded and ready to use in
Activity.onPause() . |
void |
onStop()
Unbinding on stop to assure we don't leak service connection to the activity after the chat has ended.
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onHiddenChanged, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onSaveInstanceState, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenu
public void onCreate(@Nullable android.os.Bundle savedInstanceState)
onCreate
in class android.support.v4.app.Fragment
public void onStart()
Activity.onPause()
.
Note: pre appcompat-v7 23.2.x chat service will be bounded even in Activity.onStart()
onStart
in class android.support.v4.app.Fragment
public void onStop()
Activity.onStop()
. All of the chat operations should finish before in Activity.onPause()
onStop
in class android.support.v4.app.Fragment