Session management in DFINERY SDK
Follow
outline
When you integrate the DFINERY SDK, you can basically receive events for app execution (abx:start_session) and app termination (abx:end_session).
This guide is a guide on how the DFINERY SDK calls and manages events for app launch and termination.
Criteria for judging app execution and termination
In Android/iOS apps, there is an API that determines whether each app is exposed on the screen and whether it moves off the screen. The DFINERY SDK detects this and calls abx:start_session when the app runs and abx:end_session when the app ends.
Android App Life Cycle [Source]
In Android, as shown in the diagram above, there are methods to call according to the app lifecycle. Based on the above life cycle, DFINERY SDK calls abx:start_session when the app runs (onResume()) and abx:end_session when the app leaves the screen (onPause()).
iOS app life cycle [Source]
iOS also has a similar lifecycle model. According to this life cycle, abx:start_session is called when the app is launched (Active), and abx:end_session is called when the app leaves the screen (InActivie).
abx:start_session
DFINERY SDK refines the app execution conditions and calls the abx:start_session event for the following cases.
- When the user installs and runs the app. (Called with the app installation event abx:first_open event)
- If the app is already installed and you launch it 60 seconds after closing the app. (60 second rule)
- When a user opens a deep link through a tracking link issued through the DFINERY Console.(Called with abx:deeplink_open event, which is a deep link open event)
- When the user runs the app with the app completely unloaded from memory.
- (Android Only) When the user runs the app with the app's cache and data completely deleted.(In this case, since all the app's data has been deleted, the app is in the first installation state, and in this case, the abx:first_open event is also called.)
abx:end_session
The DFINERY SDK calls the abx:end_session event by setting the conditions for app termination as follows.
- When more than 60 seconds have passed since the user exited the app using the home button or multitasking mode. (60 second rule)
- When the user exits the app using the home button or multitasking mode, unloads the app from memory within 60 seconds, and then launches the app again. (In this case, the app recognizes that it has been moved out of memory and calls abx:end_session, which failed to be called when running the app, and then calls abx:start_session.)
60 Second Rule
If you look at the event call conditions of abx:start_session /abx:end_session, there is a 60 second rule. This time is used to manage the app execution session in the DFINERY SDK, and is a rule created considering the fact that the user may run the app again after taking the app off the screen.In other words, if the user launches the app again within 60 seconds after leaving the app, abx:end_session will not be called and the session will be maintained.
If 60 seconds have passed since the user left the app on the screen, the session is determined to have ended and abx:end_session is called. After this, when you run the app again, abx:start_session is called to indicate that the session has been run again.
Web
In the case of web, abx:start_session is called at SDK init. When init is called for each page, the abx:start_session event is called. Even if you set the abx:end_session event for page termination, the event will not be called if the page is forcibly terminated. The abx:end_session event is not used because the abx:end_session event cannot be 100% guaranteed to be called.