Last active
June 10, 2022 10:15
-
-
Save frogermcs/f23d071438e98b2383ed44f759505607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseActivity extends AppCompatActivity { | |
@Inject | |
AnalyticsTools analyticsTools; | |
@Override | |
protected void onStart() { | |
super.onStart(); | |
trackScreenView(); | |
} | |
protected void trackScreenView() { | |
String screenName = getScreenNameForAnalytics(); | |
analyticsTools.logScreenLaunch(screenName); | |
} | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
//Your screen is being destroyed. It's a good time to let your analytics tools know | |
//that it would be safe to send all events and release the queue | |
analyticsTools.flush(); | |
} | |
public abstract String getScreenNameForAnalytics(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment