LifecycleListener createLifecycleListener ( final WeakReference < ComapiChatClient > ref ) { return new LifecycleListener ( ) { /** * App foregrounded. * * @param context Application context */ public void onForegrounded ( Context context ) { ComapiChatClient client = ref . get ( ) ; if ( client != null ) { client . service ( ) . messaging ( ) . synchroniseStore ( null ) ; } } /** * App backgrounded. * * @param context Application context */ public void onBackgrounded ( Context context ) { } } ; }
Creates listener for Application visibility .