04-01-2019 07:54 - edited 04-01-2019 07:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-01-2019 07:54 - edited 04-01-2019 07:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hey everyone,
Posting data using the Fetch API in the companion app requires an internet connection
However, what happens with the data when such internet connection is not provided?
Does the Fetch API buffer all the post requests until a stable connection is available?
Or will all requests be lost (because internal storage is not provided inside the companion app itself)?
Best,
Bram
Answered! Go to the Best Answer.
Accepted Solutions
04-01-2019 09:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-01-2019 09:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You have 5mb storage in the companion https://dev.fitbit.com/build/reference/companion-api/local-storage/

04-01-2019 08:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-01-2019 08:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I believe that fetch() will just fail if there isn't an active internet connection. You'll need to handle that in your companion code.

04-01-2019 09:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-01-2019 09:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Ah ok,
But what are the possibilities to handle such failures?
From other posts, I've concluded that it is not possible to store intermediate data in the companion app... When a post request (with e.g. data from the ionic) fails, then this data will be lost forever?

04-01-2019 09:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-01-2019 09:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You have 5mb storage in the companion https://dev.fitbit.com/build/reference/companion-api/local-storage/

04-01-2019 09:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-01-2019 09:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for the info!
I will provide my own fallback mechanisms when fetching the data using this internal storage as buffer.

