How do i check for internet connectivity

Now my app gets data via an API… using fetch.
How do I do a check if internet is available or not, so that i can return a message — Network Error

Same question! Is it possible to detect network state without writing native code?



you can try fetching something from a fast and reliable server with reasonable timeout set on the XMLHttpRequest

Igor Lins e Silva, thank you for the answer!

This is a good solution but looks like fuse can’t run fetch when app is in background mode, so I can only detect network state when app is running. I’m developing some kind of a chat so I need to notify users when their phone was disconnected from internet

We currently don’t have extensive support for running things in the background, but you could take a look at Fuse.BackgroundDownload library and adapt the Foreign code used there to your needs.

Uldis, thank you, I’ll try.

PS Can’t wait to see background code execution feature inside Fuse :slight_smile: