Last active
July 19, 2017 15:20
-
-
Save t-kashima/f2f3be8aeedbf348c3b2172b8d36cff8 to your computer and use it in GitHub Desktop.
Send transited activity to Fabric
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
... | |
override fun onResume() { | |
super.onResume() | |
saveTransitionScreenName() | |
val transitionScreenName = getTransitionScreenName() | |
Timber.d("ScreenName: " + transitionScreenName) | |
Crashlytics.setString("ScreenName", transitionScreenName) | |
} | |
private fun saveTransitionScreenName() { | |
val sp = getSharedPreferences("preferences", Context.MODE_PRIVATE) | |
val edit = sp.edit() | |
val screens = sp.getString("screens", "").split(" > ").takeLast(4).toMutableList() | |
screens.add(javaClass.simpleName) | |
val screenName = screens.joinToString(" > ") | |
edit.putString("screens", screenName) | |
edit.apply() | |
} | |
private fun getTransitionScreenName(): String { | |
val sp = getSharedPreferences("preferences", Context.MODE_PRIVATE) | |
return sp.getString("screens", "") | |
} | |
... |
Author
t-kashima
commented
Jul 19, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment