You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to track App Open and App Closed events, Below code i have used. I'm getting App Open Event but i couldn't get App Close Event, is there anyone know how track app close event
class AppLifecycleTracker : Application.ActivityLifecycleCallbacks {
private var numActivitiesStarted = 0
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
if (numActivitiesStarted == 0) {
// app launched
Amplitude.getInstance().logEvent("APP_OPEN")
}
numActivitiesStarted++
}
override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
}
override fun onActivityDestroyed(activity: Activity?) {
numActivitiesStarted--
if (numActivitiesStarted == 0) {
// app killed
Amplitude.getInstance().logEvent("APP_CLOSE")
}
}
override fun onActivityResumed(activity: Activity?) {
}
override fun onActivityPaused(activity: Activity?) {
}
override fun onActivityStarted(activity: Activity?) {
}
override fun onActivityStopped(activity: Activity?) {
}
}
The text was updated successfully, but these errors were encountered:
Any update on this. Even in our app end session events are not getting tracked. Also if you reopen the app again there is no start session event logged. Below is the code
@raghunandankavi2010 How do you implement the app open and close events? For session events, if they are within a short time, we won't create new session events.
I want to track App Open and App Closed events, Below code i have used. I'm getting App Open Event but i couldn't get App Close Event, is there anyone know how track app close event
class AppLifecycleTracker : Application.ActivityLifecycleCallbacks {
private var numActivitiesStarted = 0
}
The text was updated successfully, but these errors were encountered: