# Session duration in Mobile apps

**URL:** <https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878>\
**Category:** Real User Monitoring\
**Tags:** mobile-monitoring, user-sessions\
**Created:** [August 8, 2025, 9:53pm UTC](https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878 "2025-08-08T21:53:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [August 8, 2025, 9:53pm UTC](https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878/1 "2025-08-08T21:53:10Z")

</div>

Hi,

Recently we have a case raised by our client - Why a mobile session remains live&nbsp; for 35 minutes and after that its duration becomes 18 secs. We open a support ticket and an idea based on communication there. Here are the details (about the support ticket and the suggested idea): &nbsp;[https://community.dynatrace.com/t5/Product-ideas/Automatically-End-Mobile-Sessions-Upon-App-Closure/idi-p/282899](https://community.dynatrace.com/post/282899)

Now I’m reading the documentation again: [User sessions in RUM Classic — Dynatrace Docs](https://docs.dynatrace.com/docs/observe/digital-experience/rum-concepts/user-session#user-session-end--mobile-apps)

From what I see there is 2 cases when a sessions will stay alive for 35 minutes and after that the real calculations will be done:

After 10 minutes of inactivity on a mobile device.[1](https://docs.dynatrace.com/docs/observe/digital-experience/rum-concepts/user-session#fn-3-1-def)  
When the user or the mobile operating system closes or force stops the app.[1](https://docs.dynatrace.com/docs/observe/digital-experience/rum-concepts/user-session#fn-3-1-def), [2](https://docs.dynatrace.com/docs/observe/digital-experience/rum-concepts/user-session#fn-3-2-def)

in both cases we have (1) where it is written: user session remains live in the Dynatrace web UI for up to 35 minutes after that.

But what about: **When the session is ended via the Dynatrace API. ? -** There is no such remark on this. My question is what is this API that our customer can use to end the session on time (e.g. as in their case - to show the session as ended after 18 secs in Dynatrace UI and not after 35 minutes) ?

Regards, Deni

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [August 8, 2025, 10:03pm UTC](https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878/2 "2025-08-08T22:03:46Z")

</div>

Hi&nbsp;[@deni](https://community.dynatrace.com/user/90225),&nbsp;the API is the RUM JavaScript API&nbsp;[RUM Classic JavaScript API](https://www.dynatrace.com/support/doc/javascriptapi/doc/index.html)

Search for DtrumApi and the method **endSession**

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [August 8, 2025, 10:11pm UTC](https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878/3 "2025-08-08T22:11:10Z")

</div>

Hi [@DanielS](https://community.dynatrace.com/user/35788) ,  
Thanks for your reply!

It was confirmed in the support ticket that this is not supported in the Mobile apps. In the web apps it is written:

“When the session is ended via the [RUM JavaScript API](https://docs.dynatrace.com/docs/observe/digital-experience/web-applications/additional-configuration/customize-rum) by calling the dtrum.endSession() function.”, but in the mobile it is just: “When the session is ended via the Dynatrace API.”&nbsp; - when I read something like API I imagine that it is some kind of POST http(s):// …, but these are just guesses.&nbsp; Anyway confirmed by the support “endSession” will not work in mobile, but the documentation still says that there is such API …

---

<div class="post-metadata">

**Author:** ![Patrick\_H](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/patrick_h/32/37540_2.png) [@Patrick\_H](https://community.dynatrace.com/u/Patrick_H)\
**Post date:** [August 11, 2025, 7:42am UTC](https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878/4 "2025-08-11T07:42:31Z")

</div>

The endVisit API on the mobile agents (and also RUM SDK) just ends the current session and starts a new one. All new data will be sent with the new session. BUT: the end session event does not trigger an immediate closure of the live session, as closed session will be written to a different immutable storage - so the still are kept open for the default timeout in case there is delayed data being received (e.g. actions in old sessions still active during session switch) which &nbsp;could no longe be adde to the ended session if instantly marked as no longe live on cluster side.

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [August 11, 2025, 1:50pm UTC](https://community.dynatrace.com/t/session-duration-in-mobile-apps/52878/5 "2025-08-11T13:50:53Z")

</div>

It was strange to me why mobile sessions in Dynatrace always stay alive for 35 minutes — but now I understand why.

As [@Patrick\_H](https://community.dynatrace.com/user/31862)&nbsp; explainedendVisit() will start a new session, but that doesn’t mean the old one is immediately closed.

**Why?**

In mobile apps, users often work offline. Unlike web apps, mobile apps store a lot of data locally and send it to the server later. If a session were marked as inactive in Dynatrace and, afterwards, the phone flushed its cached data, that data would be lost — because Dynatrace can’t modify sessions that are no longer live.

This is intentional. It would be misleading if a session originally appeared to last 10 seconds, but then suddenly jumped to 12 minutes when late data arrived.

Since Dynatrace can’t predict exactly when a mobile device will send its cached data, it keeps the session alive for the full 35-minute timeout period.
