Open starer93 opened 4 years ago
Incase anyone needs this. The best advice I would give is that make MIxpanelApi singleton and then access the singleton in all the other classes.
`class MixPanelUtils private constructor(context : Context) { private val mixPanel: MixpanelAPI = MixpanelAPI.getInstance(context, BuildConfig.MIXPANEL_TOKEN)
companion object {
@Volatile
private var instance: MixPanelUtils? = null
fun getInstance(context: Context) = instance ?: synchronized(this) {
instance ?: MixPanelUtils(context).also {
instance = it
}
}
}
}`
I have a project with multiple activities and fragments. So what is the best way to use Mixpanel? ( I would like to track the whole application)
any advice is appreciated.