Solved

using Heap for offline app

  • 18 April 2023
  • 3 replies
  • 143 views

Badge

Hi,

First-timer here. What I can’t find answer to is whether it’s possible to use Heap to capture in-product data when we have app that works offline (as well as online).

Usecase: a user would login and start using the app online, but at some point during their session the app would go offline and user would spend majority of time in this state.

I’m guessing the answer would be yes - (service workers?), but would appreciate an answer here is this out of the box or we need some development. Links would be helpful also.

Thanks!

icon

Best answer by ALabs I Bhupender 20 April 2023, 05:42

View original

3 replies

Userlevel 3
Badge +1

Hi,

The answer to your question is yes, Heap captures the data while your app is offline. On mobile apps events are batched and sent to Heap servers every 15 seconds. If no network connection is present, events are cached locally and sent to Heaps server when the app is back online.

If you are thinking if the performance or network usage by your app is impacted due to this, the answer would be no as the data is stored in a SQLite database until it is successfully sent. While online, this database should stay under a few hundred KB. While offline, it will grow with the number of events stored. However, even if we overestimate it should not be more than a megabyte for 1000 events.

Hope this helps!

Userlevel 5
Badge +3

Your reference to service workers prompted me to add another answer, since I am not familiar with any use of service workers in a native mobile app. 

  • Heap supports offline caching on native mobile apps using our native mobile SDKs.
  • Heap does not support offline caching on the web using our web snippet.

Docs:

iOS Autocapture (and legacy iOS SDK)

Android Autocapture (and legacy Android SDK)

 

Badge +1

Hi @jonathan,

if I understand your answer correctly, there is no possibility to use Heap in offline-first PWA apps out of the box, right?  Is it perhaps considered for the future?

 

Thanks and regards,

Jan 

Reply