/** * Clear the application cache */ private void clearApplicationCaches(Context context) { mDataHandler.clear(); // network event will not be listened anymore try { mContext.unregisterReceiver(mNetworkConnectivityReceiver); } catch (Exception e) { Log.e(LOG_TAG, "## clearApplicationCaches() : unregisterReceiver failed " + e.getMessage(), e); } mNetworkConnectivityReceiver.removeListeners(); // auto resent messages will not be resent mUnsentEventsManager.clear(); mLatestChatMessageCache.clearCache(context); mMediaCache.clear(); if (null != mCrypto) { mCrypto.close(); } }
private void Search_CheckMessageSearch_(boolean withLazyLoading) throws Exception { final LazyLoadingScenarioData data = mLazyLoadingTestHelper.createScenario(withLazyLoading); final CountDownLatch lock = new CountDownLatch(1); data.aliceSession.pauseEventStream(); data.aliceSession.resumeEventStream(); data.aliceSession.getDataHandler().clear(); data.aliceSession.searchMessageText("Bob message", Collections.singletonList(data.roomId), 0, 0, null, new TestApiCallback<SearchResponse>(lock) { @Override public void onSuccess(SearchResponse info) { Assert.assertEquals(1, info.searchCategories.roomEvents.results.size()); super.onSuccess(info); } }); mTestHelper.await(lock); mLazyLoadingTestHelper.clearAllSessions(data); }