title: How to get the event for the Firebase analytics for the exit screens in android application
body: <p>I have integrated the Firebase analytics in my android application. I need to know how to get the detailed events where the user exits the application.</p>
  
  <p>For example, if user opens 
  screen-1 -> screen-2,
  then screen-2 -> screen-3,
  then close the application from screen 3 then have to get the event for exits the application from the screen-3.</p>
  
  <p>Yes, I can implement this based on the onBackPressed click but if the user will press the home key and then kills the application from recent tabs then how could we get this event?</p>
  
  <p>Also, In my application, it will add only the activity will be shown in the user engagement screen and not showing the details of the fragments which are actually used by the user.</p>
  
  <p>I am also attaching the screenshot for this below.</p>
  
  <p><a href="https://i.stack.imgur.com/gurRA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gurRA.png" alt="user engagement screen"></a></p>
  
  <p>Soo, how can I stop pushing the data for the Activity and upload the data for the fragment only on the User Engagement on Firebase Analytics.</p>
  
  <p>I have put the following code on my Activity Class for stop pushing data on Analytics</p>
  
  <pre><code>firebaseAnalytics = FirebaseAnalytics.getInstance(this);
      firebaseAnalytics.setAnalyticsCollectionEnabled(false);
  </code></pre>
  
  <p>And for the pushing data from fragment, I am using following code in my fragment class</p>
  
  <pre><code>firebaseAnalytics = FirebaseAnalytics.getInstance(getActivity());
      firebaseAnalytics.setCurrentScreen(getActivity(), this.getClass().getSimpleName(), this.getClass().getSimpleName());
  </code></pre>
  
  <p>Please help me how to implement this in my android application.</p>